論壇帖子列表頁呼叫帖子摘要教程
阿新 • • 發佈:2019-02-18
歡迎使用Markdown編輯器寫部落格
增加到 module/forum/forum_forumdisplay.php line 810
前一句是
//內容摘要
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’]
後一句是
兩個之間. 獲取主題內容以及附件