找回密码
 立即注册
搜索

途迹耕耘

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

GMT+8, 2025-12-22 05:44 , Processed in 0.210334 second(s), 14 queries .

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

[复制链接]
DZ教程 发表于 2021-5-4 16:58:41 | 显示全部楼层 |阅读模式
增加到 module/forum/forum_forumdisplay.php line 810
前一句是 threadids[threadindex] = $thread[‘tid’];
  1. //内容摘要
  2.          include_once libfile('function/post');
  3.         include_once libfile('function/attachment');
  4.         $thread['post'] = C::t('forum_post')->fetch_all_by_tid_position($thread['posttableid'],$thread['tid'],1);
  5.         $thread['post'] = array_shift($thread['post']);
  6.         $thread['preview'] = messagecutstr($thread['post']['message'], 200);
  7.         $attachments = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$thread['post']['tid'], 'pid', $thread['post']['pid']);
  8.         $attachs = $imgattachs = array();
  9.         foreach(C::t('forum_attachment')->fetch_all_by_id('pid', $thread['post']['pid'], 'aid') as $attach) {
  10.                 $attach = array_merge($attach, $attachments[$attach['aid']]);
  11.                 $attach['filenametitle'] = $attach['filename'];
  12.                 $attach['ext'] = fileext($attach['filename']);
  13.                 getattach_row($attach, $attachs, $imgattachs);
  14.         }
  15.         $thread['attachments'] = $imgattachs;
  16.         //内容摘要END
复制代码
模板调用代码:
$thread[‘preview’]

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

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