| disabling xhtml tags? [message #25332] |
Sun, 08 April 2007 23:59  |
taber Messages: 2 Registered: April 2007 Location: Maryland |
Junior Member |
|
|
Hi everyone,
I tried searching the forums but couldn't find anything on this...
Is there a way to choose whether symfony outputs XHTML / HTML4 tags? For example, something like adding:
define('SF_XHTML_TAGS', false);
...to my front controller, or even adding something to my global symfony prefs would be ideal.
Then all of the HTML symfony outputs would be like so:
<img src="..." alt="...">
as opposed to:
<img src="..." alt="..." />
Just wondering, thanks!
-taber
|
|
|
|
| Re: disabling xhtml tags? [message #25604 is a reply to message #25332 ] |
Fri, 13 April 2007 06:58   |
pezetgee Messages: 734 Registered: March 2006 |
Faithful Member |
|
|
Yes, strangely enough the tag() function has $open parameter but it looks like that none of the asset helper functions use it!
So here is my solution:
1. Add the following to your settings.yml
all:
.settings:
use_html_tags: true
then modify tag() function in TagHelper.php
function tag($name, $options = array(), $open = false)
{
if (!$name)
{
return '';
}
return '<'.$name._tag_options($options).(($open || sfConfig::get('sf_use_html_tags')) ? '>' : ' />');
}
You could modify app.yml instead of settings,yml and then change config param in the TagHelper.php
Anyway, this way you can still switch between open and closed tags.
Don't forget to change for open tags:
1. doctype
2. html prolog
3. favicon link
Otherwise your site will not validate.
Also, unless this will make to the official symfony code, you'll need to do the above changes every time you upgrade symfony.
And just mumbling to myself: you must have some good reason to still use HTML
EDIT:
I've created ticket with this solution...
[Updated on: Fri, 13 April 2007 07:13]
|
|
|
| Re: disabling xhtml tags? [message #25605 is a reply to message #25604 ] |
Fri, 13 April 2007 07:09  |
taber Messages: 2 Registered: April 2007 Location: Maryland |
Junior Member |
|
|
That's awesome, that'll work, thank you!
Of course! The reason is that XHTML is simply tag soup/invalid HTML4 at this point. 
Thanks again!
-taber
|
|
|