'default' modifier

From: Date: Wed, 13 Jun 2001 10:35:05 +0000
Subject: 'default' modifier
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-879@lists.php.net to get a copy of this message
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

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