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

Logical operators inside assigns

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
Thue
Smarty Rookie


Joined: 06 Jul 2006
Posts: 5

PostPosted: Thu Jul 06, 2006 7:39 pm    Post subject: Logical operators inside assigns Reply with quote

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


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

PostPosted: Thu Jul 06, 2006 8:09 pm    Post subject: Re: Logical operators inside assigns Reply with quote

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
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 -> Feature Requests 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