New "set" plugin

From: Date: Tue, 16 May 2006 18:55:40 +0000
Subject: New "set" plugin
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13431@lists.php.net to get a copy of this message
I've created a new function that set or assign a value to a variable. It work also with and can create simple arrays! The optional parameter "if" is used to set the value if the test is true. The test can be: 'empty', '!empty', 'is_null', '!is_null', 'isset', '!isset', 'is_void'. The new command 'is_void' test if the variable is empty and != 0, very useful for test $_REQUEST parameters. See and download from: http://smarty.incutio.com/?page=set - - - Example, create a new variable like "assign" plugin: {set var=$foo value="bar"} Example, create a new blank variable like "setvar" plugin: {set var=$foo} Example, create a new blank array: {set var=$foo.bar} Example, create a new array item: {* $foo is an array or do not exist *} {set var=$foo.bar value=true} Example, change a variable value only if it is null (great for $_REQUEST variables): {* $foo is a null variable *} {set var=$foo value="bar" if=is_null} -- Davide "Design" Muzzarelli www . dav - muz . net www. fraw . info - a PHP framework with Smarty

« previous php.smarty.general (#13431) next »