discuz

推荐列表 站点导航

当前位置:首页 > 建站教程 > discuz >

discuz 帖子列表页调用摘要代码

来源:网络整理  作者:网络  发布时间:2020-12-11 01:17
需要修改文件/source/module/forum/forum_forumdisplay.php 第812行左右找到: $threadids[$threadindex] = $thread[tid]; 复制代码 在其下方...


需要修改文件/source/module/forum/forum_forumdisplay.php 第812行左右找到:
$threadids[$threadindex] = $thread['tid'];
20161221更新
另一些直接写在模板的方法:
$thread['preview']
在其下方增加
都有效,任选其一即可。
<!--{eval $threadlist_message = DB::result(DB::query("SELECT message FROM ".DB::table('forum_post')." WHERE `tid` = $thread[tid] AND `first` =1"));}--> <!--{echo cutstr($threadlist_message,300)}-->  
代码1:
复制代码
<!--{eval require_once(DISCUZ_ROOT."./source/function/function_post.php");}--> <!--{echo messagecutstr(DB::result_first('SELECT `message` FROM '.DB::table('forum_post').' WHERE `tid` ='.$thread[tid].' AND `first` =1'),300);}-->  

模板中调用代码:
//内容摘要 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  

代码2:
复制代码

相关热词: 调用 discuz

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/jz/discuz/2378.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

discuz 帖子列表页调用摘要代码

2020-12-11 编辑:网络



需要修改文件/source/module/forum/forum_forumdisplay.php 第812行左右找到:
$threadids[$threadindex] = $thread['tid'];
20161221更新
另一些直接写在模板的方法:
$thread['preview']
在其下方增加
都有效,任选其一即可。
<!--{eval $threadlist_message = DB::result(DB::query("SELECT message FROM ".DB::table('forum_post')." WHERE `tid` = $thread[tid] AND `first` =1"));}--> <!--{echo cutstr($threadlist_message,300)}-->  
代码1:
复制代码
<!--{eval require_once(DISCUZ_ROOT."./source/function/function_post.php");}--> <!--{echo messagecutstr(DB::result_first('SELECT `message` FROM '.DB::table('forum_post').' WHERE `tid` ='.$thread[tid].' AND `first` =1'),300);}-->  

模板中调用代码:
//内容摘要 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  

代码2:
复制代码

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/jz/discuz/2378.shtml

相关文章

风云图片

推荐阅读

返回discuz频道首页