discuzX3.2论坛帖子列表页调用帖子摘要实例
2015-01-28 11:23
405 查看
论坛帖子列表页调用帖子摘要使用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']
两个之间. 获取主题内容以及附件
//内容摘要
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论坛帖子调用js的php代码
- Discuz X3.2 论坛关闭后,MySQL帖子导出为.csv
- 论坛帖子放js代码不让混淆功能影响js运行的方式,如discuz的管理员调用其它数据到帖子中
- 学习Discuz! X3.2记录:自定义论坛帖子字段,在门户中显示帖子列表
- Discuz!论坛教程之去掉帖子列表页的附件图标的方法
- discuz帖子列表页调用帖子作者头像
- destoon调用discuz论坛中带图片帖子的实现方法
- 海河写的 Discuz论坛帖子调用js的php代码
- Discuz!NT版本论坛帖子调用
- discuz 帖子列表页调用封面图片
- destoon调用discuz论坛中带图片帖子的方法
- destoon调用discuz论坛中带图片帖子的实现方法
- DedeCms调用Discuz论坛主题等数据方法总结
- PHPCMS v9调用Discuz!X 论坛数据
- 心雨中调用Discuz论坛IE6中代码出现乱码
- discuz调用帖子图片并从左向右滚动
- [e:loop]栏目列表页调用内容页的文章实例
- DEDE调用DZ X1.5或者DZ论坛帖子的N种方法
- 如何调用discuz!X2.5帖子到其他的网站上