dt限制標題字數的方法有幾種,最簡單的是一種是:
{dsubstr($t[title], 42, '..')}
還有一種是列表輸出,也是網上常用的方法
<!--{tag("moduleid=5&length=36&condition=status=3 and level>0 and thumb<>''&areaid=$cityid&pagesize=".$DT['page_sell']."&order=addtime desc&width=100&height=100&cols=5&target=_blank&lazy=$lazy&template=thumb-table")}-->
但是今天爲廣大修改是直接的,默認修改法。
首先找到/module/photo/ 因爲我要修改的是圖庫列表,所以填寫的是photo
找到:list.htm.php
搜索:
$r['alt'] = $r['title'];
在下面有一個
$r['title'] = set_style(dsubstr($r['title'], 42, '..'), $r['style']);
這個:42就是你修改的輸出的字數,默認UTF一箇中文佔3個字符,GBK一箇中文佔2個字符。
接着找到:list.inc.php
搜索:
$r['alt'] = $r['title'];
在下面找到:
$r['title'] = set_style(dsubstr($r['title'], 42, '..'), $r['style']);
42就是字符,改成你想要的即可!
然後保存即可,效果展示:http://zhimo.yuanzhumuban.cc/photo/fangyuankou/