Re: [SMARTY-GENERAL] What are the postfilters for?

From: Date: Sun, 07 Apr 2002 01:51:54 +0000
Subject: Re: [SMARTY-GENERAL] What are the postfilters for?
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3529@lists.php.net to get a copy of this message
These are good points. A couple of issues I can think of: 1) Output buffering would have to be used to manipulate the output of the php scripts. Probably not a big deal, but a slight performance issue to every non-cached page hit, which brings us to #2... 2) As it stands, the postfilters execute once at compile time (so maybe these would be more accurately described as template compile pre/post filters.) A filter that acts on the output of the compiled template would have to execute on every hit to the page... although it would get cached with template caching turned on, so then it would only happen each time the page expires. Thoughts? Monte Michal Prinke wrote:
Can you show me some practical use of postfilters? Modifying compiled templates looks hard to me - you can easily corrupt the inner PHP code doing anything more advanced than adding a footer or a header. For instance - when I remove template indenting (= trim all the lines), should I do this through a prefilter, or a postfilter? Even then, there could be some whitespace in template variables, which cannot be removed by a postfilter. So, maybe Smarty should have something like post-post-filter - a filter which works on the final, generated page, with all the variables already substituted. It can be useful e.g. for converting documents to various codepages - e.g. "utf-8" for WML and "iso-8859-1" for WWW (having all the templates in "win-1250" standard). And it's far easier to operate on pure HTML document - you don't have do pay attention to protect Smarty/PHP tags. --- Michal Prinke


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