|
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 |
Thue Smarty Rookie
Joined: 06 Jul 2006 Posts: 5
|
Posted: Thu Jul 06, 2006 7:39 pm Post subject: Logical operators inside assigns |
|
|
A little thing which would have been handy today:
Code: |
{assign var="foo" value=true}
{assign var="bar" value=false}
{assign var="baz" value="`$foo&&$bar`"}
|
This doesn't work. It currently works for math, so for example
Code: |
{assign var="foo" value=1}
{assign var="bar" value=2}
{assign var="baz" value="`$foo+$bar`"}
|
works
Regard, Thue |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Jul 06, 2006 8:09 pm Post subject: Re: Logical operators inside assigns |
|
|
Thue wrote: | It currently works for math, so for example
Code: |
{assign var="foo" value=1}
{assign var="bar" value=2}
{assign var="baz" value="`$foo+$bar`"}
|
works
|
That's a shame. Backticks weren't intended to support math, afaik -- but booleans and logical operators are only supported in {if} statements. OTOH, you can use {math}.
http://smarty.php.net/manual/en/language.function.math.php |
|
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
|