|
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 |
GoodDeer Smarty Rookie
Joined: 09 Sep 2004 Posts: 6
|
Posted: Tue Sep 14, 2004 12:08 pm Post subject: smarty v2.6.5 : {if} and variables evaluation issues |
|
|
Hi,
I just found this little bug in smarty 2.6.5 :
Here's a template sample (assuming you have an array in links) :
Code: | {section name=pg loop=$links}
{$smarty.section.pg.last}
{$smarty.section.pg.first}
{if $smarty.session.pg.last} {* doesn't work either with .first *}
pipo
{/if}
{/section} |
Smarty expands the $smarty.session.pg.last to 1 or 0 as a variable but evaluated in the {if }, a "Notice: Undefined index: pg " error occurs.
It does the same with the .first and .index but only when evaluated in a {if }
Could someone confirme that ? |
|
Back to top |
|
jaey Smarty Regular
Joined: 25 May 2004 Posts: 36 Location: Louisville, Kentucky, USA
|
Posted: Tue Sep 14, 2004 1:38 pm Post subject: |
|
|
You have $smarty.session instead of $smarty.section in your {if} statement. |
|
Back to top |
|
GoodDeer Smarty Rookie
Joined: 09 Sep 2004 Posts: 6
|
Posted: Tue Sep 14, 2004 2:40 pm Post subject: |
|
|
Oh no ! I look at this code a hour before posting ... and I didn't see that !
Thanks :-) |
|
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
|