Re: [SMARTY-DEV] assign() and null-values
| From: | Monte Ohrt | Date: | Wed, 08 Jan 2003 16:11:46 +0000 |
| Subject: | Re: [SMARTY-DEV] assign() and null-values | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-505@lists.php.net to get a copy of this message | ||
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>