- 论坛徽章:
- 0
|
Insert 函数类似 inluce 函数,不同之处是 insert 所包含的内容不会被缓存,每次调用该模板都会重新执行该函数.
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}
or
index.php:
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->caching = true;
function smarty_block_dynamic($param, $content, &$smarty) {
return $content;
}
$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
$smarty->display('index.tpl');
index.tpl:
Page created: {"0"|date_format:"%D %H:%M:%S"}
{dynamic}
Now is: {"0"|date_format:"%D %H:%M:%S"}
... do other stuff ...
{/dynamic} |
|