码迷,mamicode.com
首页 > Web开发 > 详细

discuzX3.2论坛帖子列表页调用帖子摘要实例

时间:2015-01-28 12:29:52      阅读:1388      评论:0      收藏:0      [点我收藏+]

标签:

论坛帖子列表页调用帖子摘要使用G变量无法获取,网上找到的解决方案 与大家分享

//内容摘要
include_once libfile(‘function/post‘);
include_once libfile(‘function/attachment‘);
$thread[‘post‘] = C::t(‘forum_post‘)->fetch_all_by_tid_position($thread[‘posttableid‘],$thread[‘tid‘],1);
$thread[‘post‘] = array_shift($thread[‘post‘]);
$thread[‘preview‘] = messagecutstr($thread[‘post‘][‘message‘], 200);
$attachments = C::t(‘forum_attachment_n‘)->fetch_all_by_id(‘tid:‘.$thread[‘post‘][‘tid‘], ‘pid‘, $thread[‘post‘][‘pid‘]);
$attachs = $imgattachs = array();
foreach(C::t(‘forum_attachment‘)->fetch_all_by_id(‘pid‘, $thread[‘post‘][‘pid‘], ‘aid‘) as $attach) {
$attach = array_merge($attach, $attachments[$attach[‘aid‘]]);
$attach[‘filenametitle‘] = $attach[‘filename‘];
$attach[‘ext‘] = fileext($attach[‘filename‘]);
getattach_row($attach, $attachs, $imgattachs);
}
$thread[‘attachments‘] = $imgattachs;
//内容摘要END

增加到 module/forum/forum_forumdisplay.php  line 810 
前一句是 $threadids[$threadindex] = $thread[‘tid‘];

后一句是 $_G[‘forum_threadlist‘][$threadindex] = $thread;

模板调用代码:
$thread[‘preview‘]
两个之间.  获取主题内容以及附件

discuzX3.2论坛帖子列表页调用帖子摘要实例

标签:

原文地址:http://www.cnblogs.com/pauper/p/4255318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!