1 直接写
{php}
$s = "";
for($i =0;$i< 10 ; $i++){
$s .= "aabb";
}
echo $s;
{/php}2 调用写法
在php文件中...加下下面的方法
function test ( $params ) {
extract($params);
for ( $i = 0; $i<$repeat; $i++ ) {
$result .= $string;
}
return $result;
}
$mySmarty -> register_function ( "ReEcho", "test" ) ;然后在你的tpl里,需要重复显示的地方,写上
{ReEcho string="aabb" repeat=10}