Re: show_info_header() and show_info_include()

From: Date: Thu, 21 Mar 2002 00:46:11 +0000
Subject: Re: show_info_header() and show_info_include()
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3157@lists.php.net to get a copy of this message
Good catch, I didn't really test the prefilter too well :-) Although the smarty object ($this) is already passed to the filter, I'm sure the current template name can be gotten from there instead of passing it as a third parameter. Manfred Wischin wrote: > > Hi! > I think it is good that the two functions are replaced by a prefilter > options, but the simulating prefilter function needs to know the > template filename. > > I use the following function to simulate the old behavior > > function smarty_prefilter_showinfoheader($source, &$smarty, $tpl_file="") > { > return "<!-- Smarty include-start: $tpl_file -->".$source."<!-- > Smarty include-end: $tpl_file -->"; > } > > I modified Smarty_Compiler.class.php > > function _compile_file($tpl_file, $template_source, &$template_compiled) > { > [...] > // run template source through prefilter functions > if (count($this->_plugins['prefilter']) > 0) { > foreach ($this->_plugins['prefilter'] as $filter_name => > $prefilter) { > if ($prefilter[3] || function_exists($prefilter[0])) { > $template_source = $prefilter[0]($template_source, > $this, $tpl_file); > > ~~~~~~~~~~~~~ > $this->_plugins['prefilter'][$filter_name][3] = true; > } else { > $this->_trigger_plugin_error("Smarty plugin error: > prefilter '$filter_name' is not implemented"); > } > } > } > [...] > } > > It would be very nice, if that modification could be included into the > main tree. > thanx > cu > Manfred Wischin > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

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