Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

nested tags inside name attribute

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
liviu.gelea
Smarty Rookie


Joined: 25 Nov 2015
Posts: 16

PostPosted: Fri Dec 18, 2015 1:05 pm    Post subject: nested tags inside name attribute Reply with quote

It appears checking for illegal characters inside the name attribute does not allow nested smarty tags or backticks and/or variables.
We use [% %] as delimiters. This also fails if I try to use backticks

Code:

... Syntax error in template...
"[%foreach from=$row.ToValues key="fieldChanged" item="fieldFrom" name="fieldsChanged[%$row.IdLicenceHistory%]" %]"
 'name' attribute/variable has illegal value <-- thrown in ...\smarty_internal_templatecompilerbase.php on line 47

Smarty version 3.1.29-dev/3
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Dec 19, 2015 11:08 pm    Post subject: Reply with quote

Smarty does not accept a name attribute which is variable.
Why do you need it at all, as it is optional.

Smarty has implemented the PHP like version of {foreach}.
See http://www.smarty.net/docs/en/language.function.foreach.tpl

It allow using special attributes like index, iteration etc. much simpler.
Back to top
View user's profile Send private message
liviu.gelea
Smarty Rookie


Joined: 25 Nov 2015
Posts: 16

PostPosted: Mon Dec 21, 2015 9:22 am    Post subject: Thanks Reply with quote

Thanks for your answer. I suspected you might not want to fix this in smarty 3 due to it's non-standard-ness. I fixed this in my project but since I inherited a very large legacy codebase (smarty 2), my fixes might have been far from perfect.
Thanks for your time.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP