Re: 'default' modifier
| From: | Andrei Zmievski | Date: | Wed, 13 Jun 2001 13:56:52 +0000 |
| Subject: | Re: 'default' modifier | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-880@lists.php.net to get a copy of this message | ||
We'll take a look at this suggestion.
At 12:35 PM 6/13/01 +0200, Ivo Jansch wrote:
Hi,
I want all my variables to be passed through a function before they are
being output.
This can be used to striptag all vars, or to do something else with
them.
The template editors should not have to do a {$var|defaultmodifier} in
their templates. It has to be done even if someone just uses {$var}.
To accomplish this, I added this to the _parse_modifiers function:
if ($this->default_modifier!="")
{
$modifiers[] = $this->default_modifier;
}
But now the problem is that vars not only get modified when displaying,
but also in conditions:
If I have a template like this:
{if $value==""}
Hello World... {$value}
{/if}
$value gets modified twice, which in my case is unnecessary (I do some parsing of the content and it's a lot of overhead if the parsing is done twice). Is there a way to call this default modifier only on display, and not in conditions? Maybe some context should be passed down to _parse_modifiers, so I can do something like (if $mode==DISPLAY && $this->_default_modifier!="") ... Greetings, Ivo -- Ivo Jansch <ivo@ibuildings.nl> ibuildings.nl BV - information technology http://www.ibuildings.nl --- You are currently subscribed to smarty as: andrei@ispi.net To unsubscribe send a blank email to $subst('Email.Unsub') Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/-Andrei