I am rather confused about how to use post / pre filters with smarty.
What I need to do, is to search and replace certain elements in the page before it is displayed. I would rather like to do this right before $smarty->display is called. That means, before it gets saved to disk, but after it has been compiled (so, postfilter).
Example postfilter function:
function smarty_postfilter_replace($tpl_output, $search, $replace)
{
return str_replace($search, $replace, $tpl_output);
}
How do I apply this right before smarty output. I have tried after looking at the Smarty documentation ( http://www.smarty.net/docsv2/de/advanced.features.postfilters.tpl ) and some other examples, but none seems to be working.
can someone give me an example code on how to do this, and how to pass parameters to the filter ($search, $replace).
Thanks