现在在写一个站, 要在smarty 插件那里写一个列表插件,要截取标题长度。
- PHP code
PageExecute($sql,$pagesize,$page);
$rs=$rs->getRows();
$smarty->assign($length,$length);
$smarty->assign($varname, $rs);
unset($rs);
}
?>
上面是插件代码;
- HTML code
{--list cate="articles" items="Title" length=4 varname="rs"--}
{--foreach from=$rs item=r--}
{--$r.Title--}
{--/foreach--}
上面是模板代码。
现在就是要截取标题长度,和标题连接
$r.Titletruncatecn:$length:"...":true
这种的是不行的!各位师兄,师姐谢谢了!
------解决方案--------------------