DedeCMS列表页调用文章正文方法
以下是织梦DedeCMS列表页调用文章正文的第一种方法:
AIn" style="border-width: 0px; border-style: initial; border-color: initial; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; background: none 0% 0% repeat scroll transparent; margin: 0px; overflow-wrap: break-word; border-radius: 0px; box-sizing: content-box !important; overflow: visible !important; width: auto !important; vertical-align: baseline !important; right: auto !important; position: static !important; float: none !important; color: black !important; outline-width: 0px !important; padding: 0px !important; outline-style: none !important; left: auto !important; min-height: auto !important; line-height: 1.1em !important; top: auto !important; bottom: auto !important;">{dede:arclist flag='h' row='1'}<h1><a href="[field:arcurl/]">[field:title/]</a></h1><p>[field:id runphp='yes']$aid = @me;$row = $GLOBALS['dsql']->GetOne("Select body From 'dede_addonarticle' where aid='$aid' ");@me = cn_substr(strip_tags("{$row['body']}"),400);[/field:id]<a href="[field:arcurl/]">【阅读详细】</a></p>{/dede:arclist}代码中的数字400是用来设置需要调用多少内容的,因为调用的是body里面的内容,如果有里面包含代码的话也会被调用出来,这点比较不好,不过可以使用html2tex()函数解决一下。
第二种方法则调用的代码如下:
{dede:arclist row='10' addfields='body' channelid='1'}<p>[field:body function='cn_substr(html2text(@me),600)'/]...</p><span class="more"><a href="[field:arcurl/]" style="text-decoration:none;color:#990000;">[详情]</a></span>{/dede:arclist}addrields="字段一,字段二…"idlist:文章编号,调用指定内容function=’cn_substr(html2text(@me),600)’ 将文章内容转化为文字格式channelid,模型编号,文章默认为1,查看位置:后台–核心–内容模型管理两种方法各有优劣,第一种方法比较繁琐,不是那么容易看懂。还是比较推荐采用第二种方法实现织梦DedeCMS列表页调用文章正文的功能的。
