[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-dev
Subject: Re: [SMARTY-DEV] Modifier function arguments
From: Johannes Findeisen <mailman () hanez ! org>
Date: 2005-02-16 0:55:11
Message-ID: 200502160155.11743.mailman () hanez ! org
[Download RAW message or body]
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);
> }
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic