|
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 |
Norman Smarty Rookie
Joined: 30 Dec 2003 Posts: 7 Location: Cedar Rapids, IA
|
Posted: Tue Jan 27, 2004 10:43 pm Post subject: Problem with Addition |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jan 27, 2004 11:11 pm Post subject: |
|
|
{assign var="last" value=$start+3} |
|
Back to top |
|
Norman Smarty Rookie
Joined: 30 Dec 2003 Posts: 7 Location: Cedar Rapids, IA
|
Posted: Wed Jan 28, 2004 12:47 am Post subject: |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Jan 28, 2004 5:45 pm Post subject: |
|
|
simple math needs smarty-2.6.0 or later. |
|
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
|