Re: [SMARTY-GENERAL] What are the postfilters for?
| From: | Monte Ohrt | Date: | Mon, 08 Apr 2002 15:37:47 +0000 |
| Subject: | Re: [SMARTY-GENERAL] What are the postfilters for? | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3559@lists.php.net to get a copy of this message | ||
The problem I see is that we cannot handle filters on the _output_ of the templates via plugins. For instance, I have a plugin that cleans up whitespace in the document before it goes to the browser. This would be better applied to the template output instead of the PHP script itself so that it covers variable values, etc. However, I cannot do this with a plugin, I must extend the Smarty class as Andrei shows here. Therefore I cannot offer a drop-in solution for proper white space cleaning. It would be nice to be able to offer functionality like this as a plugin instead of requiring class extentions.
Andrei Zmievski wrote:
At 12:29 PM 4/7/02 -0500, Monte Ohrt wrote:-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.The only downside to that is that it is not automated. If there is something you always want applied to all template output, you have to do in in your application each time. Also when you apply your own changes after a fetch, the same performance issues apply (fetch uses output buffering)What's the problem? class My_Smarty extends Smarty {... function display($template, $cache_id = null, $compiled_id = null) { $content = $this->fetch($template, $cache_id, $compile_id); // apply processing to $content; echo $content; }} $smarty = new My_Smarty(); ... $smarty->display('my_template.tpl'); -Andrei