Page 1 of 1
Smarty variable variables don't validate in template. Bug?
Posted: Thu Dec 06, 2012 9:30 am
by noosphere
Hello,
I had variable variables in Smarty template with CMSMS 1.9 and worked fine.
After upgrading to 1.11 they're not accepted. The template would not vaildate. Then it randomly validated!
I pasted the full template's source in phpMyAdmin and it's fine.
But still the Apply button would not allow me to save changes.
This is the "bad" fully Smarty-valid code:
Code: Select all
{section name=loop start=1 loop=$created[nu].pcs}
{assign var = 'idx' value = "pc`$smarty.section.loop.index`"}
{$created[nu].$idx}
{/section}
Hope you can fix it

Re: Smarty variable variables don't validate in template. Bu
Posted: Sun Dec 09, 2012 3:43 am
by frankmanl
Not knowing much about SMARTY I'd say the ` is incorrect.
To me it looks strange to have single quotation marks within double quotation marks.
And most of all you should not use ` but '.
Re: Smarty variable variables don't validate in template. Bu
Posted: Sun Dec 09, 2012 8:27 am
by Jos
Did you upgrade to 1.11 or to 1.11.3
only in case of 1.11.3 you can read Stikki's post here
http://forum.cmsmadesimple.org/viewtopi ... 64#p290164
Re: Smarty variable variables don't validate in template. Bu
Posted: Mon Dec 10, 2012 10:21 am
by fredp
frankmanl wrote:
Not knowing much about SMARTY I'd say the ` is incorrect.
To me it looks strange to have single quotation marks within double quotation marks.
And most of all you should not use ` but '.
Hi,
Backticks are necessary if the variable name contains a period(.):
Online Smarty 3 docs wrote:Embedding Vars in Double Quotes
- Smarty will recognize assigned variables embedded in "double quotes" so long as the variable name contains only numbers, letters and under_scores. See naming for more detail.
- With any other characters, for example a period(.) or $object->reference, then the variable must be surrounded by `backticks`.
- In addition Smarty3 does allow embedded Smarty tags in double quoted strings. This is useful if you want to include variables with modifiers, plugin or PHP function results.
Re: Smarty variable variables don't validate in template. Bu
Posted: Mon Dec 10, 2012 2:48 pm
by noosphere
Thank you for replying. It seems this issue is related to what Stikki's being working in SVN.
Yes, version is 1.11.3. I'll check new version asap.
Have a nice day all.
PS:
frankmanl wrote:
Not knowing much about SMARTY I'd say the ` is incorrect.
This is for you then
http://www.smarty.net/docsv2/en/languag ... quotes.tpl