"if" with "or"-problem
| From: | Matthias Mohr | Date: | Thu, 03 Apr 2003 11:35:07 +0000 |
| Subject: | "if" with "or"-problem | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9050@lists.php.net to get a copy of this message | ||
Hi!
I just have a small problem with an if-expression inside a smarty template:
test.php:
--------------------------------------------------
$smarty->assign( "Flag1", 0 );
$smarty->assign( "Flag2", 0 );
$smarty->display( 'MyTpl.tpl' );
--------------------------------------------------
MyTpl.tpl:
--------------------------------------------------
<!-- Flag1={$Flag1}; Flag2={$Flag2} -->
{if $Flag1|default:0 eq 1 or $Flag2|default:1 eq 1}
true<br>
{else}
false<br>
{/if}
--------------------------------------------------
The result is as follows:
--------------------------------------------------
<!-- Flag1=0; Flag2=0 -->
true
--------------------------------------------------
But why, both Flags are 0?
Does the default-modifier don't work correct?
Or am I doing something wrong?
BTW, it's smarty v2.4.2 and php 4.3.1
with regards,
Matthias