discuzX3.2论坛帖⼦列表页调⽤帖⼦摘要实例论坛帖⼦列表页调⽤帖⼦摘要使⽤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']
两个之间. 获取主题内容以及附件
discuz还有人用吗
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论