SV: [SMARTY] Smarty gotcha
| From: | Paolo Nesti Poggi | Date: | Sun, 21 Sep 2003 18:17:53 +0000 |
| Subject: | SV: [SMARTY] Smarty gotcha | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10256@lists.php.net to get a copy of this message | ||
Hi,
this is from the manual:
<quote>
"eq", "ne","neq", "gt", "lt", "lte",
"le", "gte" "ge","is even","is odd",
"is not even","is not odd","not","mod","div
by","even by","odd
by","==","!=",">",
"<","<=",">=" are all valid conditional qualifiers, and
must be separated from surrounding elements by spaces.
<unquote>
It should cover your example
Paolo
> -----Oprindelig meddelelse-----
> Fra: Gerard Samuel [mailto:gsam@trini0.org]
> Sendt: 21. september 2003 06:08
> Til: Travis Low
> Cc: smarty-general@lists.php.net
> Emne: Re: [SMARTY] Smarty gotcha
>
>
> 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
> >
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>