Re: [SMARTY-DEV] assign() and null-values
| From: | Nichlas Löfdahl | Date: | Wed, 08 Jan 2003 18:28:49 +0000 |
| Subject: | Re: [SMARTY-DEV] assign() and null-values | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-506@lists.php.net to get a copy of this message | ||
Aye, it works with the latest CVS-version. Nice :)
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Nichlas Löfdahl (acc)" <crotalus@acc.umu.se>
Cc: "Smarty Dev" <smarty-dev@lists.php.net>
Sent: Wednesday, January 08, 2003 5:11 PM
Subject: Re: [SMARTY-DEV] assign() and null-values
> What version of Smarty? Try the latest CVS, see if this still happens.
> Looking at the code, assign should assign any value given, even null.
>
>
> On Wed, 2003-01-08 at 10:00, Nichlas Löfdahl (acc) wrote:
> > Greetings!
> >
> > I've noticed a small problem with the assign-function and null-values.
> >
> > For example, look at this loop in a template:
> >
> > {foreach item=entry from=$entries}
> > {assign var="foo" value=$entry.title}
> > {if $foo}
> > The title is {$foo}
> > {/if}
> > {/foreach}
> >
> > This will work fine as long as every entry has a title, BUT if some
entry has null as title null,
> > assign won't do anything and keep the old value.
> >
> > Wouldn't a better solution be to clear_assign a variable if a null-value
is supplied?
> >
> > Nichlas
> --
> Monte Ohrt <monte@ispi.net>
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php