discuz教程:模板内写代码实现贴子摘要调用方法 [复制链接]

moqu8 2017-10-4

6 0

forumdisplay_list.htm文件查找:

1
<a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_G['gp_archiveid']}archiveid={$_G['gp_archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else}{/if} class="xst" >$thread[subject]</a>

后面加上

1
 <p><!--{eval require_once(DISCUZ_ROOT."./source/function/function_post.php");}-->                   <!--{echo messagecutstr(DB::result_first('SELECT `message` FROM '.DB::table('forum_post').' WHERE `tid` ='.$thread[tid].' AND `first` =1'),120);}--></p>

其中  ,120)  为内容摘要的字数,可以自行控制。

完成后更新缓存即可 

望采纳


最新回复 (0)
返回
支持中心
邮箱:winkill2012@qqcom
新站优化中!部分功能尚未完善,敬请谅解!
支持中心