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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] 首页热门帖 CACHE 版 For D4.1

[复制链接]
5025488.net 发表于 2006-3-13 00:05:37 | 显示全部楼层 |阅读模式
作者:不是我

演示:http://www.5025488.net/index.php

1、include/cache.func.php

查找:
  1.                 'index'                => array('announcements', 'onlinelist', 'forumlinks'),
复制代码

改为:
  1.                 'index'                => array('announcements', 'onlinelist', 'forumlinks','topview','topreply','toppostnum'),
复制代码


查找:
  1.                 case 'ranks':
  2.                         $table = 'ranks';
  3.                         $cols = 'ranktitle, postshigher, stars, color';
  4.                         $conditions = "ORDER BY postshigher DESC";
  5.                         break;
复制代码

下面加:
  1. // 首页热门帖 CACHE 版 For D4.1 //
  2.                 case 'topview':
  3.                         $table = 'threads';
  4.                         $cols='dateline,tid,subject,author,views,replies';
  5.                         $conditions = "ORDER BY views DESC LIMIT 0,10";
  6.                         break;
  7.                 case 'topreply':
  8.                         $table = 'threads';
  9.                         $cols='dateline,tid,subject,author,views,replies';
  10.                         $conditions = "ORDER BY replies DESC LIMIT 0,10";
  11.                         break;
  12.                 case 'toppostnum':
  13.                         $table = 'members';
  14.                         $cols='username, uid, posts';
  15.                         $conditions = "ORDER BY posts DESC LIMIT 0, 10";
  16.                         break;
  17. // 首页热门帖 CACHE 版 For D4.1 //
复制代码

查找:
  1.         $query = $db->query("SELECT $cols FROM {$tablepre}$table $conditions");
  2.         switch($cachename) {
复制代码

下面加:
  1. // 首页热门帖 CACHE 版 For D4.1 //
  2.                 case topview:
  3.                         while($thread=$db->fetch_array($query)) {
  4.                                 $thread[subject0]=$thread[subject];
  5.                                 $thread['subject'] = cutstr($thread['subject'], 35);
  6.                                 $data[]=$thread;
  7.                         }
  8.                         break;
  9.                 case topreply:
  10.                         while($thread=$db->fetch_array($query)) {
  11.                                 $thread[subject0]=$thread[subject];
  12.                                 $thread['subject'] = cutstr($thread['subject'], 35);
  13.                                 $data[]=$thread;
  14.                         }
  15.                         break;
  16.                 case toppostnum:
  17.                         $notime=time();
  18.                         while($toppostnums=$db->fetch_array($query)) {
  19.                                 $toppostnums['uptime']=$notime;$data[]=$toppostnums;
  20.                         }
  21.                         break;
  22. // 首页热门帖 CACHE 版 For D4.1 //
复制代码


二、index.php

查找:
  1. if(empty($gid)) {

  2.         $navigation = $navtitle = '';
复制代码

上面加:
  1. // 首页热门帖 CACHE 版 For D4.1 //
  2. $hack_subject_len=35;
  3. $hack_subject_num=10;
  4. $cachetime=3600*10;
  5. $upcache=$_DCACHE['toppostnum']['0']['uptime'];
  6. if(($timestamp-$upcache)>$cachetime) {
  7.         $indexflag=1;require_once DISCUZ_ROOT.'./include/cache.func.php';
  8.         updatecache('toppostnum');
  9. }
  10. $hack_newthreads_threadlist = array();
  11. $thread = array();
  12. $query = $db->query("SELECT dateline,tid,subject,author,views,replies FROM {$tablepre}threads ORDER BY dateline DESC LIMIT 0, $hack_subject_num");
  13. while($thread = $db->fetch_array($query)) {
  14.         $thread[subject0]=$thread[subject];
  15.         $thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
  16.         $hack_newthreads_threadlist[] = $thread;
  17. }
  18. // 首页热门帖 CACHE 版 For D4.1 //
复制代码


三、templates/default/index.htm

查找:
  1. <!--{if !empty($newpmexists)}-->
  2.         <div class="maintable">
  3.         {template pmprompt}
  4.         </div>
  5. <!--{/if}-->
复制代码

下面加:
  1. <!-- Hot hack -->
  2. {template hack_index_hot_topics}
  3. <!-- Hot hack end -->
复制代码


最后将附件中的文件上传至论坛 templates/default/ 目录下 后台更新缓存,完成!

本帖子中包含更多资源

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

x

评分

1

查看全部评分

zjcx 发表于 2006-3-13 00:13:14 | 显示全部楼层
不喜欢这个

好像加查询的
回复

使用道具 举报

zhansh 发表于 2006-3-13 04:33:58 | 显示全部楼层
比较喜欢这样的,可是没找到
http://www.eguodu.com/bbs/
回复

使用道具 举报

xkyy 发表于 2006-3-13 05:31:17 | 显示全部楼层
支持拉
回复

使用道具 举报

 楼主| 5025488.net 发表于 2006-3-13 10:08:07 | 显示全部楼层
原帖由 zjcx 于 2006-3-13 00:13 发表
不喜欢这个

好像加查询的


是 CACHE 版
回复

使用道具 举报

ZR 发表于 2006-3-15 13:25:13 | 显示全部楼层
有增加一个查询吧?
回复

使用道具 举报

泡海椒 发表于 2006-3-15 14:18:29 | 显示全部楼层
不错ing

支持一个。。。。。。。。。。。。。
回复

使用道具 举报

kisslbz 发表于 2006-3-18 17:21:53 | 显示全部楼层
支持先
回复

使用道具 举报

sylvan 发表于 2006-3-18 17:38:28 | 显示全部楼层
支持下
回复

使用道具 举报

wishyou 发表于 2006-3-18 17:49:31 | 显示全部楼层
1.希望加个折叠按钮
2.感觉怪怪的,最好能美化一下啊
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-6 19:56 , Processed in 0.108820 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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