Re: [SMARTY-DEV] Modifier function arguments

From: Date: Wed, 16 Feb 2005 00:55:11 +0000
Subject: Re: [SMARTY-DEV] Modifier function arguments
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2644@lists.php.net to get a copy of this message
Hello, i don't know if i understand this right. An example of what i want to do: I have a script that is assigning some variables to Smarty. In my case i am assigning a variable called CORE_URL. This is the URL of the website which is read from a config file. After these variables are assigned i am parsing the content against Smarty and with the use of some modifiers. Lets say i have a modifier like this: function smarty_modifier_smile( $message ) { $message = str_replace(":-)", "<img style=\"vertical-align: text-bottom;\" src=\"" . $smarty->_tpl_vars['CORE_URL'] ."images/smilies/icon_smile.gif\" alt=\"smile\" title=\"smile\" />", $message); return $message; } This modifier is replacing ":-)" with a html image tag. This tag needs a variable that is assigned to Smarty ($smarty->_tpl_vars['CORE_URL']) to build the full path to the image. I have tried your example but it didn't work for me... I'm getting an error like this: <b>Fatal error</b>: Smarty error: [in /data/hanez/www/xcssor/htdocs/themes/xw3/design.ihtml line 56]: [plugin] modifier 'smile' is not implemented (core.load_plugins.php, line 36) in <b>/data/hanez/www/xcssor/lib/smarty/Smarty.class.php</b> on line <b>1088</b><br /> Could you help? Regards Johannes On Tuesday 15 February 2005 05:50, boots wrote: > function MySmarty() > { >     $this->Smarty(); >     $this->register_modifier('getvar', array('MySmarty', > 'modifier_getvar')); > } > > function modifier_getvar($bar, $baz=null) > { >     return $this->_tpl_vars($bar); > }

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