- source/module/forum/forum_forumdisplay.php
,
- if($thread[‘rushreply’]) {
- $rushtids[$thread[‘tid’]] = $thread[‘tid’];
- }
,
- $threada= C::t(‘forum_attachment’)->fetch_all_by_id(‘tid’, $thread[‘tid’], ‘aid’);
- $threadaid = reset($threada);
- $threadpic = C::t(‘forum_attachment_n’)->fetch_by_aid_uid($threadaid[‘tableid’], $threadaid[‘aid’], $thread[‘authorid’]);
- $thread[‘pic’] = $threadpic[‘attachment’];
,
- $thread[‘pic’]
,
- source/class/table/table_forum_announcement.php
,
- $orderby = ‘ORDER BY ‘.DB::order($orderby, ‘DESC’);
,
- $orderby = ‘ORDER BY ‘.DB::order($orderby, ‘ASC’);
,找到文件
- source/module/forum/forum_forumdisplay.php
大于809行找到如下代码
- if($thread[‘rushreply’]) {
- $rushtids[$thread[‘tid’]] = $thread[‘tid’];
- }
在这段代码下面添加如下代码:
- $threada= C::t(‘forum_attachment’)->fetch_all_by_id(‘tid’, $thread[‘tid’], ‘aid’);
- $threadaid = reset($threada);
- $threadpic = C::t(‘forum_attachment_n’)->fetch_by_aid_uid($threadaid[‘tableid’], $threadaid[‘aid’], $thread[‘authorid’]);
- $thread[‘pic’] = $threadpic[‘attachment’];
这样就可以在列表页模板中使用
- $thread[‘pic’]
来加载一张封面图片,但是需要注意这样是加载最后一张插入的图片!
如果要改为第一张图片还需要修改另外的一个文件
找到文件
- source/class/table/table_forum_announcement.php
找到
- $orderby = ‘ORDER BY ‘.DB::order($orderby, ‘DESC’);
修改为:
- $orderby = ‘ORDER BY ‘.DB::order($orderby, ‘ASC’);
好了这样就可在列表页,加载发帖时上传的第一张图片,做为封面来调用了!