Prefilters

PHP Smarty

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

Prefilters

预过滤器

<?php
// put this in your application
function remove_dw_comments($tpl_source, &$smarty)
{
 return preg_replace("/<!--#.*-->/U","",$tpl_source);
}

// register the prefilter
$smarty->register_prefilter("remove_dw_comments");
$smarty->display("index.tpl");
?>

{* Smarty template index.tpl *}
<!--# this line will get removed by the prefilter -->

Prev Home Next
Advanced Features Up Postfilters