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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[素材] 如何让楼主帖始终在每页的最上面 楼主贴不翻页效果

[复制链接]
raidboss 发表于 2012-6-21 09:48:46 | 显示全部楼层 |阅读模式
本帖最后由 raidboss 于 2013-1-8 16:28 编辑

如何让楼主帖始终在每页的最上面

1.找到:source\module\forum目录下forum_viewthread.php文件


找到:
  1. $_G['forum_thread']['replies'] = $temp_reply;
  2. }
复制代码
在下面添加代码:
  1. $threadpid=0;
  2. if($_G['page']>1){
  3. $post=DB::fetch_first("SELECT p.* FROM ".DB::table("forum_post")." p WHERE p.tid='{$_G['tid']}' AND p.first=1 limit 1");
  4. if($post){
  5. $threadpid=$post['pid'];
  6. if(($onlyauthoradd && $post['anonymous'] == 0) || !$onlyauthoradd) {
  7. $postlist[$post['pid']] = $post;
  8. $postusers[$post['authorid']] = array();
  9. if($post['first']) {
  10. $_G['forum_firstpid'] = $post['pid'];
  11. $metadescription = str_replace(array("\r", "\n"), '', messagecutstr(strip_tags($post['message']), 160));
  12. }
  13. }
  14. }
  15. }
复制代码
OK,缓存都不用更新。重新载入网页就OK啦...


演示地址:http://bbs.inmysky.com/
trin 发表于 2012-6-21 11:02:28 | 显示全部楼层
学习了,谢谢楼主分享!
回复

使用道具 举报

蛇镜眼是不蛇某 发表于 2012-6-21 12:32:44 | 显示全部楼层
MARK一下
回复

使用道具 举报

pcyi 发表于 2012-6-21 12:39:27 | 显示全部楼层
Mark 这个效果实现卟错 留给有需求的站长
回复

使用道具 举报

307991860 发表于 2012-6-21 16:49:30 | 显示全部楼层
不知道对SEO有没有影响,每个分页前一半都是一样的
回复

使用道具 举报

李渠 发表于 2012-6-21 19:27:41 | 显示全部楼层
不错 谢谢楼主的分享















台前新闻  台前一中   台前一高
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-29 05:09 , Processed in 0.100249 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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