织梦调用文章标题超過字数限制后显示省略号
I.般是类似于这样:
{dede:arclist
更多精彩就在: 51免费论文网|www.jxszl.com
row=I.0}
{/dede:arclist}
如果需要限制字数,可以增加titlelen=‘IX0’,代码为:
{dede:arclistrow=I.0titlelen=IX0}
{/dede:arclist}
但是,此时显示的文章标题后面直接被截断,不会有省略号,将其中的[field:title]修改成[field:fulltitlerunphp=yes]$titlefull=@me;$titleshow=cn_substr($titlefull,IX0);if($titlefull!=$titleshow){$dot=…";}else{$dot="";}@me=$titleshow.$dot;[/field:fulltitle]即可,代码为:
{dede:arclistrow=I.0}
{/dede:arclist}
当然也可以修改成这样:
{dede:arclistrow=I.0}
[field:fulltitlefunction=(strlen("@me")>IX0?cn_substr("@me",IX0)."…":"@me")/]
原文链接:http://www.jxszl.com/biancheng/dedecms/76574.html