易仿帝国yfdiguo.com

您当前的位置:首页 > 问题库

帝国CMS列表模板过滤简介的html代码的方法

zcmcss发表于2017-12-11问题库
虽然说,简介字段最好不要用编辑器,但是有时候为了方便,往往只设置一个有编辑器的字段而省去了简介字段,但是在列表中又需要调用"简介",那怎么办呢?当然是直接调用有编辑器的字段了,可是调用出来的内容又有html标签,如"<p>"、"<br>"什么的,很不好看。这时候我们就需要把这些过滤掉,这里就需要用到php的strip_tags函数了。
系统模型中的smalltext是有编辑器的字段,在列表模板中调用smalltext
$smalltext = esub(strip_tags($r[smalltext]),120);
$listtemp='<li>
<a href="[!---titleurl--]" class="app-logo w95" target="_blank">
<img src="[!---titlepic--]" alt="[!---oldtitle--]"></a>
<div class="app-list-main">
<h3><a target="_blank" href="[!---titleurl--]">[!---title--]</a><span class="fl star"><img src="[!---news.url--]skin/shouyou84/images/[!---star--]star.png" border="0" /></span></h3>
<p>语音:[!---language--]&nbsp;&nbsp;类型:<a href="[!---this.classlink--]" target="_blank">[!---this.classname--]</a></p>
<p style="height: 40px; overflow: hidden;">'.$smalltext.'</p>
</div>
<div class="app-list-r">
<p><a href="[!---titleurl--]" class="dl-btn" target="_blank"></a></p>
</div>
</li>';

热门问题

©2017 易仿帝国yfdiguo.com


友情链接: 阿里云优惠网| 阿里云推荐码| 阿里云教程| 莫愁博客|
♥ www.yfdiguo.com
联系作者QQ: