|
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 |
Dirtbox Smarty Rookie
Joined: 07 Nov 2003 Posts: 11 Location: Belfast
|
Posted: Fri Nov 07, 2003 9:52 am Post subject: simple assignments |
|
|
Hello
Im currently working on a system using smarty and im a smarty nooby . I have this problem and it has me stumped.
{assign var="num" value="$coninfo[contact][2]"}
This assign statement is contained within a {section} loop, but the value that i really need is $coninfo[contact][2]+1, is there a way to get this happening within a smarty template???
any help would be greatly appreciated |
|
Back to top |
|
mystrymaster Smarty Rookie
Joined: 31 Oct 2003 Posts: 17
|
Posted: Fri Nov 07, 2003 3:38 pm Post subject: |
|
|
I am pretty sure that the array reference via [] will kill your template - I am not 100% as I just started using smarty myself but I though I read that somewhere |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Nov 07, 2003 5:50 pm Post subject: |
|
|
Actually, the way it is setup (in a section, referenced by a section loop name), that array reference is completely valid.
To get the results you want, either use the math plugin function (check the manual and also the plugins section here at the forum) or if you can stand using a beta, 2.6.0-RC2 allows for simple math to be embedded. For example, {assign var="num" value=$coninfo[contact][2]+1} should work as expected (note: spaces are not allowed in the simple math)
HTH |
|
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
|