æ�’å…¥æ�’件是用æ�¥å®žçŽ°æ¨¡æ�¿ä¸{insert}æ ‡ç¾çš„调用。
string smarty_insert_name( |
$params, | Â |
| Â |
$template); |
 |
array $params;object $template;函数的第一个�数是输入的属性数组。
æ�’入函数将会返回æŸ�值,该值将在模æ�¿ä¸çš„{insert}æ ‡ç¾å¤„被替æ�¢ã€‚
Example 18.11. �入�件
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: insert.time.php
* Type: time
* Name: time
* Purpose: æ�’å…¥è®¾å®šæ ¼å¼�的当å‰�日期/æ—¶é—´
* -------------------------------------------------------------
*/
function smarty_insert_time($params, Smarty_Internal_Template $template)
{
if (empty($params['format'])) {
trigger_error("insert time: missing 'format' parameter");
return;
}
return strftime($params['format']);
}
?>
