discuz!怎样实现主题列表页显示帖子正文摘要?非预览功能。
如下图那样显示对应的主题的正文前200字。但对应的模版文件里好像没有“内容”的变量啊,求教
------解决方案--------------------
重点看红色区域的代码,应该会对你有用,这个是直接获得该文章的内容,
------解决方案--------------------
不建议在模版文件中执行查询
打开后台文件\source\module\forum\forum_forumdisplay.php
<br />//搜索foreach($threadlist as $thread) {<br />//在其上面添加<br />foreach($threadlist as $v){<br /> $tids[]=$v['tid'];<br />}<br />$strtids=join(',',$tids);<br />$msginfos=DB::fetch_all("SELECT tid,message FROM %t WHERE tid IN($strtids)",array('forum_post'));<br />if(!function_exists('messagecutstr')){<br /> require_once libfile('function/post');<br />}<br />foreach($msginfos as $v){<br /> $cutmsginfos[$v['tid']]=messagecutstr($v['message'],200);<br />}<br />//在其下面添加<br />$thread['cutmsg']=$cutmsginfos[$thread['tid']];<br />
<br /><!--230行左右,</tbody>上面添加--><br /><tr><br /> <td colspan="6">$thread['cutmsg']</td><br /> </tr><br />
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号