<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

dedecms标题加省略号的实现方法

时间:2020-12-15

这里给出不需要修改程序,只修改模板的方法。举例,下面的标题列表,最长的标题50字节,只想显示30字节,模板代码如下:
           <ul>
                {dede:arclist titlelen='50' row='10'}
                <li><a title="[field:title /]" href="[field:filename /]">[field:title   function=' ( strlen("@me")>30 ? cn_substr("@me",30)."…" : "@me" ) ' /]</a></li>
                {/dede:arclist}
            </ul>

很明显,解决问题的关键在于用 [field:title   function=' ( strlen("@me")>30 ? cn_substr("@me",30)."…" : "@me" ) ' /] 代替了原来的 [field:title /] ,在输出标题时多了一个判断的过程,先判断标题是否大于30字节,如果大于则只输出30字节的长度,并加上省略号。而title=" [field:title /]" 则不受影响,鼠标移上去时显示标题的全部内容。
0
首页
案例
关于
联系