|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tgenannt Smarty Rookie
Joined: 05 Dec 2009 Posts: 5
|
Posted: Sat Dec 05, 2009 2:18 pm Post subject: Bug in {assign}? |
|
|
Hello,
I'am using the {assign} tag like this:
Code: | {assign var="trStyles" index=0 value='style="background-color:#FFFFFF;"'}
{assign var="trStyles" index=1 value='style="background-color:#EFEFEF;"'}
|
This produces the following compiled output:
Code: | $_tmp0 = 'style="background-color:#FFFFFF;"'; $_smarty_tpl->append("trStyles",$_tmp,true,null,null); unset ($_tmp);
$_tmp1 = 'style="background-color:#EFEFEF;"'; $_smarty_tpl->append("trStyles",$_tmp,true,null,null); unset ($_tmp); |
There seems to be a mismatch between the names of the temporary variable.
A fix for this problem is to replace the line Code: | return "<?php \$_tmp$_attr[index] = $_attr[value]; \$_smarty_tpl->append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>"; | with this line Code: | return "<?php \$_tmp$_attr[index] = $_attr[value]; \$_smarty_tpl->append($_attr[var],\$_tmp$_attr[index],true,$_nocache,$_scope); unset (\$_tmp$_attr[index]);?>"; | in the class Smarty_Internal_Compile_Assign.
Greetings,
Tobias |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Dec 05, 2009 3:35 pm Post subject: |
|
|
Where did you got this
Code: | {assign var="trStyles" index=0 value='style="background-color:#FFFFFF;"'} |
syntax from?
It was never intended that index is an attribute of the assign tag.
It was used internally for mapping the new assign syntax
Code: | {$trStyles[0]='style="background-color:#FFFFFF;"'} |
to the assign compiler code.
I think I must close this hole.... |
|
Back to top |
|
tgenannt Smarty Rookie
Joined: 05 Dec 2009 Posts: 5
|
Posted: Sat Dec 05, 2009 3:42 pm Post subject: |
|
|
I found the "index" attribute in the code of the mentioned class and thought I could just use it.
I will convert my template to use the new assign syntax. |
|
Back to top |
|
|
|
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
|