w3-tools.com - Free Webmaster Tools and Resources
 
w3-tools.com - Free Webmaster Tools and Resources
 Free Webmaster Tools and Resources

 



Smarty Manual

This manual is provided as a courtesy. It is not an official source. Please check smarty.php.net for updated information.

Smarty Manual

Smarty Manual

Postfilters

Template postfilters are PHP functions that your templates are ran through after they are compiled. Postfilters can be either registered or loaded from the plugins directory by using load_filter() function or by setting $autoload_filters variable. Smarty will pass the compiled template code as the first argument, and expect the function to return the result of the processing.

Example 15-3. using a template postfilter

<?php
// put this in your application
function add_header_comment($tpl_source, &$smarty)
{
    return 
"<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source;
}

// register the postfilter
$smarty->register_postfilter('add_header_comment');
$smarty->display('index.tpl');
?>

This will make the compiled Smarty template index.tpl look like:

<!-- Created by Smarty! -->
{* rest of template content... *}

See also register_postfilter(), prefilters and load_filter()

Newsletter

Join to our newsletter and receive news and updates about our site.
Your name: 
E-mail address: 
Action: 
 

Hosted by

Search

Google
Web w3-tools.com

Links

  What is my IP? Find your IP address!     Valid XHTML 1.0 Transitional  
Copyright © 2006. by w3-tools.com. All rights reserved