Postfilters

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 15. Advanced Features Next

Postfilters

<?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");
?>

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

Prev Home Next
Prefilters Up Output Filters