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

Problem with Addition

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Norman
Smarty Rookie


Joined: 30 Dec 2003
Posts: 7
Location: Cedar Rapids, IA

PostPosted: Tue Jan 27, 2004 10:43 pm    Post subject: Problem with Addition Reply with quote

Everyone,
I'm trying to do some addition, in my php code I'm assiging:

Code:

$tpl->assign('start', intval(date('Y')));


And in smarty:
Code:

{assign var="last" value="$start+3"}


But doesn't seem to be working.. I just get "2004 + 3"

This is what's printing out:
Start: 2004 - End: 2004+3
Seems like it's just doing "Concat" on it.. but it should be a int value to begin with..

Any suggestions?
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Jan 27, 2004 11:11 pm    Post subject: Reply with quote

{assign var="last" value=$start+3}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Norman
Smarty Rookie


Joined: 30 Dec 2003
Posts: 7
Location: Cedar Rapids, IA

PostPosted: Wed Jan 28, 2004 12:47 am    Post subject: Reply with quote

That didn't seem to work either:
Code:

{assign var="last_year" value=$start_year+3}


It's still doing the same thing:

Start: {$start_year} - End: {$last_year}

yields:
Start: 2004 - End: 2004+3

messju wrote:
{assign var="last" value=$start+3}
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Jan 28, 2004 5:45 pm    Post subject: Reply with quote

simple math needs smarty-2.6.0 or later.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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 -> Tips and Tricks 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