Compiler Functions

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 16. Extending Smarty With Plugins
利用插件扩展smarty
Next

Compiler Functions编译函数

<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File: compiler.tplheader.php
 * Type: compiler
 * Name: tplheader
 * Purpose: Output header containing the source file name and
 * the time it was compiled.
 * -------------------------------------------------------------
 */
function smarty_compiler_tplheader($tag_arg, &$smarty)
{
 return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
}
?>
{* this function gets executed at compile time only *}
{tplheader}
<php
echo 'index.tpl compiled at 2002-02-20 20:02';
?>

Prev 来源:PHP中文社区 Home Next
Block Functions[块函数] Up [预滤器/后滤器]Prefilters/Postfilters