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'}
Syntax Rules for quotes
-
Pierre M.
Re: Syntax Rules for quotes
Hello,
I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?
Pierre M.
I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?
Pierre M.
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Syntax Rules for quotes
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.
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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Syntax Rules for quotes
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:Pierre M. wrote: Hello,
I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?
... title="John's page">
... title='The "home" page'>
are both valid (x)HTML (loose or strict)
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info

