// 首先自定义一个函数
//tpl 调用形式<{hsp times="4" size="5" con="hello world" color="red"}>
function test1($args){
$str="";
for($i=0;$i<$args['times'];$i++){
$str.="<font color=' " .$args['color']. " 'size=' " .$args['size']. " '>".$args['con']."</font>"
}
retrun $str;
}
//自定义一个函数过后要经过注册才能使用
$smarty->register_function("fengtansong","test1");
//指定模板显示结果
$smarty->display("test1.tpl");
//test1.tpl模板测试
<h1>这里测试自定义模板的使用</h1>
<{fngtansong times="20" con="测试自定义模板" color="red" size="10" }>