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

a = b + 5 in smarty ??????????

 
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
suzie
Smarty n00b


Joined: 09 Jul 2003
Posts: 1

PostPosted: Wed Jul 09, 2003 8:39 am    Post subject: a = b + 5 in smarty ?????????? Reply with quote

to put a variable in an other variable in a template, I know that I can do that :

<{assign var="a" value=$b}>

But it seems impossible to do that :

<{assign var="a" value=($b + 5)}>

what is the right code to make calcul and assign a variable with it (in smarty langage) ?
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Wed Jul 09, 2003 10:55 am    Post subject: Reply with quote

{math assign="a" equation="b+5" b="2"}

though it is highly recommended that you seperate logic and design and not use the math plugin
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


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

PostPosted: Wed Jul 09, 2003 4:00 pm    Post subject: Reply with quote

Aztek's comments not-withstanding, you may be interested to know that the current CVS implements a patch that adds substantial math support to Smarty.

The plugins forums contains several submitted plugins that you can use with 2.5.0 that provide faster/more convenient math operations.
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