虚位以待(AD)
虚位以待(AD)
首页 > CMS教程 > Discuz! > discuz教程:实现主题列表页显示帖子正文摘要

discuz教程:实现主题列表页显示帖子正文摘要
类别:Discuz!   作者:码皇   来源:互联网   点击:

不建议在模版文件中执行查询打开后台文件sourcemoduleforumforum_forumdisplay phpPHP code 搜索foreach($threadlistas$thread){ 在其上面添加foreach($threadlistas$v){$tids=$v;}$strtids=join( , ,$tids);$ ,魔客吧
不建议在模版文件中执行查询
打开后台文件sourcemoduleforumforum_forumdisplay.php
PHP code
//搜索foreach($threadlist as $thread) { //在其上面添加 foreach($threadlist as $v){     $tids[]=$v['tid']; } $strtids=join(',',$tids); $msginfos=DB::fetch_all("SELECT tid,message FROM %t WHERE tid IN($strtids)",array('forum_post')); if(!function_exists('messagecutstr')){     require_once libfile('function/post'); } foreach($msginfos as $v){     $cutmsginfos[$v['tid']]=messagecutstr($v['message'],200); } //在其下面添加 $thread['cutmsg']=$cutmsginfos[$thread['tid']];

前台用$thread['cutmsg']就可以获取
打开模版文件templatedefaultforumforumdisplay_list.htm
<!--230行左右,</tbody>上面添加--> <tr>                                     <td colspan="6">$thread['cutmsg']</td>                                 </tr>


样子如上图所示,样式自己调  
相关热词搜索: discuz教程:实现主题列表页显示帖子正文摘