> Smarty模板引擎中文在线手册 > Block Functions [块函数]

register_block(), unregister_block().

Example 16-5. block function

<?PHP
/*
 * smarty plugin
 * -------------------------------------------------------------
 * File: block.translate.php
 * Type: block
 * Name: translate
 * Purpose: translate a block of text
 * -------------------------------------------------------------
 */
function smarty_block_translate($params, $content, &$smarty)
{
 if (isset($content)) {
 $lang = $params['lang'];
 // do some intelligent translation thing here with $content
 return $translation;
 }
}

上一篇:
下一篇: