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

simple assignments

 
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 -> General
View previous topic :: View next topic  
Author Message
Dirtbox
Smarty Rookie


Joined: 07 Nov 2003
Posts: 11
Location: Belfast

PostPosted: Fri Nov 07, 2003 9:52 am    Post subject: simple assignments Reply with quote

Hello Surprised

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 Surprised
Back to top
View user's profile Send private message
mystrymaster
Smarty Rookie


Joined: 31 Oct 2003
Posts: 17

PostPosted: Fri Nov 07, 2003 3:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Nov 07, 2003 5:50 pm    Post subject: Reply with quote

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
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 -> General 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