show_info_header() and show_info_include()

From: Date: Thu, 21 Mar 2002 00:49:35 +0000
Subject: show_info_header() and show_info_include()
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3156@lists.php.net to get a copy of this message
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

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