Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

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

[复制链接]
Yecent 发表于 2014-2-12 15:03:08 | 显示全部楼层 |阅读模式
本帖最后由 Yecent 于 2014-2-12 15:05 编辑

最近一直在摸索DZ模板制作修改,发现论坛帖子列表页调用帖子摘要使用G变量无法获取,有类似的插件,但是要钱,今天终于搞定了这个问题,分享一下给大家,效果见图:


增加到 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['forum_threadlist'][$threadindex] = $thread;

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


应该有开源精神,别看到有钱了就联系我.


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
viewsnake 发表于 2014-2-12 20:53:13 | 显示全部楼层
不错,很好的修改
回复

使用道具 举报

zhangjinlu 发表于 2014-2-12 22:40:47 | 显示全部楼层
感谢楼主贡献精神,
回复

使用道具 举报

 楼主| Yecent 发表于 2014-2-13 15:04:31 | 显示全部楼层
zhangjinlu 发表于 2014-2-12 22:40
感谢楼主贡献精神,

回复

使用道具 举报

shunfei 发表于 2014-2-13 18:58:57 | 显示全部楼层
感谢楼主贡献精神
回复

使用道具 举报

-晓白 发表于 2014-2-14 03:37:32 | 显示全部楼层
555555555555555555555555555
回复

使用道具 举报

朕__ 发表于 2014-3-25 04:55:48 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

nestfly 发表于 2014-3-30 09:50:12 | 显示全部楼层
你好,我想问一下你的图片怎么显示缩略图后不变形的。
回复

使用道具 举报

 楼主| Yecent 发表于 2014-3-30 20:02:06 | 显示全部楼层
nestfly 发表于 2014-3-30 09:50
你好,我想问一下你的图片怎么显示缩略图后不变形的。

缩略图生成大小就是200PX宽,调用就不会变形
回复

使用道具 举报

nestfly 发表于 2014-3-30 22:00:10 | 显示全部楼层
Yecent 发表于 2014-3-30 20:02
缩略图生成大小就是200PX宽,调用就不会变形

如果一个帖子图片比较多,怎么让他只显示一张图片?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-18 18:17 , Processed in 0.121208 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表