register_block

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 13. Methods Next

register_block
注册一个块

/* PHP */
$smarty->register_block("translate", "do_translation");

function do_translation ($params, $content, &$smarty, &$repeat) {
if (isset($content)) {
$lang = $params['lang'];
// do some translation with $content
return $translation;
}
}

{* template *}
{translate lang="br"}
Hello, world!
{/translate}

Prev 来源:PHP中文社区 Home Next
load_filter
加载过滤器
Up register_compiler_function
注册编译函数