Syntax Rules for quotes

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Syntax Rules for quotes

Post 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'}
Pierre M.

Re: Syntax Rules for quotes

Post by Pierre M. »

Hello,

I think the xHTML specification mandates single quotes like . May be Smarty has another recommendation about tags ?

Pierre M.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Syntax Rules for quotes

Post 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.
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.
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Syntax Rules for quotes

Post 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)
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
Pierre M.

Re: Syntax Rules for quotes

Post by Pierre M. »

Thank you kermit.

Pierre M.
Post Reply

Return to “CMSMS Core”