Re: assign() and null-values

From: Date: Wed, 08 Jan 2003 16:06:21 +0000
Subject: Re: assign() and null-values
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-504@lists.php.net to get a copy of this message
Yeah, I think so to ... in PHP you can also assign null values and empty string. So why not in Smarty? "Nichlas löfdahl (acc)" <crotalus@acc.umu.se> schrieb im Newsbeitrag news:001701c2b72f$174c56a0$f986ef82@NICHLAS... 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

« previous php.smarty.dev (#504) next »