Re: [SMARTY-DEV] Support for NULL in Smarty?!

From: Date: Wed, 19 Feb 2003 14:53:52 +0000
Subject: Re: [SMARTY-DEV] Support for NULL in Smarty?!
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-734@lists.php.net to get a copy of this message
Try CVS first, I think the true/false 0/1 issue is already patched. As for null, example of what you want to do? On Wed, 2003-02-19 at 08:42, André Rabold wrote: > It was already discussed some time ago ... but I cannot find the thread > anymore and I cannot remember if a decission was made. > > I cannot use NULL as a function parameter in Smarty. But it would be very > usefull for me to explicitly set some vars to NULL. For example if a > function has set a parameter to a default value other that "" or NULL. > > One other thing I discovered is the behaviour of TRUE and FALSE within a > template. Both get compiled as 1 or 0 not as true / false. It's nearly the > same but not exacly. > > So I have created patch which "fixed" the TRUE/FALSE and adds support for > NULL: > > Index: Smarty_Compiler.class.php > =================================================================== > RCS file: /repository/smarty/Smarty_Compiler.class.php,v > retrieving revision 1.177 > diff -r1.177 Smarty_Compiler.class.php > 56c56 > < var $_permitted_tokens = > array('true','false','yes','no','on','off'); > --- > > var $_permitted_tokens = > > array('true','false','yes','no','on','off','null'); > 664a665,666 > > if (is_null($arg_value)) > > $arg_value = 'null'; > 1345c1347 > < $token = true; > --- > > $token = 'true'; > 1347c1349,1351 > < $token = false; > --- > > $token = 'false'; > > } else if ($token == 'null') { > > $token = 'null'; > > > > > Good or bad? > > André -- Monte Ohrt <monte@ispi.net>

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