Re: [SMARTY] Smarty gotcha
| From: | Gerard Samuel | Date: | Sun, 21 Sep 2003 04:08:15 +0000 |
| Subject: | Re: [SMARTY] Smarty gotcha | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10254@lists.php.net to get a copy of this message | ||
I haven't seen this behaviour with the code Im using so far.
But I use it as boolean FALSE
<?php
$foo = FALSE;
$smarty->assign('foo', $foo);
?>
{if !$foo}
Im FALSE
{/if}
Travis Low wrote:
Just found a gotcha... If you use "!" (boolean NOT) in a Smarty if statement, there must be a space between the "!" and the following "$", or the expression will always be true. In my specific case, the code is: {{if ! $p.link}} stuff {{else}} other stuff {{/if}} I didn't see the "other stuff" until I changed: {{if !$p.link}} to {{if ! $p.link}} cheers, Travis