symfony
symfony forum
Home » support » Installation and setup » disabling xhtml tags?
disabling xhtml tags? [message #25332] Sun, 08 April 2007 23:59 Go to next message
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 #25437 is a reply to message #25332 ] Wed, 11 April 2007 12:52 Go to previous messageGo to next message
mikenolan  is currently offline mikenolan
Messages: 403
Registered: October 2006
Location: Lancashire, UK
Faithful Member
No, there's not but you could create your own AssetHelper.php and redefine image_tag() etc to pass the third argument of tag() as true (which creates an open tag).
Re: disabling xhtml tags? [message #25604 is a reply to message #25332 ] Fri, 13 April 2007 06:58 Go to previous messageGo to next message
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
Rolling Eyes


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 Go to previous message
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. Wink Very Happy

Thanks again!


-taber
Previous Topic:Wamp & Sandbox half installed??
Next Topic:can't upgrad symfony using pear
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software