Page 1 of 1
Syntax Rules for quotes
Posted: Sat Sep 29, 2007 10:50 am
by Jonny
There appear to be variations between tags in the recommended use of single or double quotes. Are there global guidelines for developers and users?
Some examples from the Tag list.
{content block="Second Content Block"}
{anchor anchor='here' text='Scroll Down'}
{contact_form email="
yourname@yourdomain.com" subject_get_var="subject"}
{cms_module module='News'}
{startExpandCollapse id="name" title="Click Here"}
{global_content name='myblob'}
Re: Syntax Rules for quotes
Posted: Sat Sep 29, 2007 11:48 am
by Pierre M.
Hello,
I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?
Pierre M.
Re: Syntax Rules for quotes
Posted: Sat Sep 29, 2007 2:59 pm
by calguy1000
See this:
http://smarty.php.net/manual/en/language.syntax.quotes.php
If something is in single quotes, it's treated absolutely, if in double quotes, an attempt is made to expand any variables in there.... same if no quotes at all are specified.
So, for performance reasons, if you're using hardcoded text in a smarty call (including {cms_module module='News'} you should use single quotes.
Re: Syntax Rules for quotes
Posted: Sun Oct 14, 2007 1:29 pm
by kermit
Pierre M. wrote:
Hello,
I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?
Calguy's got the answer for Smarty up there.. but need to clarify this here: (x)HTML
doesn't care, so long as you aren't starting with a " and ending with a ' on the same value; and they aren't even required at all for numeric values in HTML. Whichever you choose to wrap your values in the markup, you can use the *other* one inside it:
... title="John's page">
... title='The "home" page'>
are both valid (x)HTML (loose or strict)
Re: Syntax Rules for quotes
Posted: Mon Oct 22, 2007 9:36 pm
by Pierre M.
Thank you kermit.
Pierre M.