Re: [SMARTY] assign filter

From: Date: Tue, 27 Aug 2002 10:31:23 +0000
Subject: Re: [SMARTY] assign filter
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5837@lists.php.net to get a copy of this message
I already have the code that i don't want to change so this is my solution (still working on it) class Myapp_Smarty extends Smarty { // remap smarty assign function to strip slashes // call constructor //smarty::Smarty(); function assign($tpl_var, $value = NULL) { if (is_array($tpl_var)){ foreach ($tpl_var as $key => $val) { if ($key != '' && isset($val)) { echo "key $key val: $val<br>"; $tpl_var[$key]=con_stripslashes($val); } } } else { if ($tpl_var != '' && isset($value)) $value=con_stripslashes($value); } smarty::assign($tpl_var,$value); } } con_stripslashes() is basicaly stripslashes function that check if there are slashes in the string before striping Thanks Peter

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