论坛帖子列表页调用帖子摘要教程

欢迎使用Markdown编辑器写博客

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

//内容摘要
         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

模板调用代码:
$thread[‘preview’]

后一句是 G[forumthreadlist][ threadindex] = $thread;

两个之间. 获取主题内容以及附件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值