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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] TOPLIST_首页四格_全Cache版FOR DZ4.1.0

[复制链接]
scropion~ 发表于 2006-3-3 00:02:17 | 显示全部楼层 |阅读模式
原插件由 oytktk (靖飒) 制作,the 4.1.0 edition is modified by apple123.net
本来我也是想别人做了我直接用的,但是论坛忙人太多了,或者可能都是高手不愿意做,那偶就帮下忙吧
演示地址

修改之前强烈建议大家备份需要修改的文件!!!
1. 上传附件到论坛的模板目录...

2. include/cache.func.php 查找
  1. 'medals'        => array('medals')
复制代码

上面加

  1. 'toplist'        => array('newthread', 'newreply', 'topdigest', 'topviews'),//TOPLIST_首页四格_全Cache版_By oytktk
复制代码

继续查找

  1. case 'medals':
  2.                         $table = 'medals';
  3.                         $cols = 'medalid, name, image';
  4.                         $conditions = "WHERE available='1'";
  5.                         break;
复制代码


上面加

  1.   //首页四格TOPLIST_CACHE版, By oytktk 代码首
  2.                 case 'newthread':
  3.                         $table = 'threads t';
  4.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  5.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 10";
  6.                         break;

  7.                 case 'newreply':
  8.                         $table = 'threads t';
  9.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  10.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1'  ORDER BY t.lastpost DESC LIMIT 0, 10";
  11.                         break;
  12.                 case 'topdigest':
  13.                         $table = 'threads t';
  14.                         $cols = 't.tid, t.fid, t.author, t.subject, t.digest, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  15.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 10";
  16.                         break;
  17.                
  18.                 case 'topviews':
  19.                         $table = 'threads t';
  20.                         $view = rand(1,3)==1 ? 'views' : 'replies';
  21.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  22.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 10";
  23.                         break;

  24.                 //首页四格TOPLIST_CACHE版, By oytktk 代码尾
复制代码




再找:

  1. case 'settings':
  2.                         $data['qihoo_links'] = array();
  3.                         while($setting = $db->fetch_array($query))
复制代码


上面加
  1. //首页四格TOPLIST_CACHE版, By oytktk 代码首

  2.                 case 'newthread':
  3.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  4.                         while($topthread = $db->fetch_array($query)) {
  5.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  6.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  7.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 28);
  8.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style="color: ".$colorarray[$threadcolor[1]].""" : NULL;
  9.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  10.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  11.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  12.                                 $data[] = $topthread;
  13.                         }
  14.                         break;

  15.                 case 'newreply':
  16.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  17.                         while($topthread = $db->fetch_array($query)) {
  18.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  19.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  20.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 26);
  21.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style="color: ".$colorarray[$threadcolor[1]].""" : NULL;
  22.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  23.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  24.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  25.                                 $data[] = $topthread;
  26.                         }
  27.                         break;

  28.                 case 'topdigest':
  29.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  30.                         while($topthread = $db->fetch_array($query)) {
  31.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  32.                                 $digest = array('1'=>'[Ⅰ]','2'=>'[Ⅱ]','3'=>'[Ⅲ]');
  33.                                 $topthread['subjectc'] = $digest[$topthread['digest']]."-".cutstr($topthread['subject'], 23);
  34.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  35.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style="color: ".$colorarray[$threadcolor[1]].""" : NULL;
  36.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  37.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  38.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  39.                                 $data[] = $topthread;
  40.                         }
  41.                         break;

  42.                 case 'topviews':
  43.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  44.                         while($topthread = $db->fetch_array($query)) {
  45.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  46.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 32);
  47.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style="color: ".$colorarray[$threadcolor[1]].""" : NULL;
  48.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  49.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  50.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  51.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  52.                                 $data[] = $topthread;
  53.                         }
  54.                         break;


  55.                 //首页四格TOPLIST_CACHE版, By oytktk 代码尾
复制代码


3. include/newthread.inc.php

查找
  1. updatepostcredits('+', $discuz_uid, $postcredits);
复制代码


下面加
  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码


4. include/newreply.inc.php

查找
  1. updatepostcredits('+', $discuz_uid, $replycredits);
复制代码

下面加
  1.   require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码


5. include/editpost.inc.php
查找

  1. updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));
复制代码


下面加

  1.    require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码


6. index.php

查找

  1. $forumlist = $catforumlist = $forums = $catforums = $categories = $collapse = array();
复制代码


下面加

  1. //首页四格TOPLIST_CACHE版, By oytktk 代码首
  2.         if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_hk2 ') === FALSE) {
  3.                 $categorys_hk2 = 'collapsed_no.gif';
  4.                 $collapse['category_hk2'] = '';
  5.         } else {
  6.                 $categorys_hk2 = 'collapsed_yes.gif';
  7.                 $collapse['category_hk2'] = 'display: none';
  8.         }
  9.         
  10.         if($categorys_hk2 == 'collapsed_no.gif'){
  11.         require_once DISCUZ_ROOT.'./forumdata/cache/cache_toplist.php';
  12.         $toplistloop = $_DCACHE['newthread'];
  13.         }
  14.         //首页四格TOPLIST_CACHE版, By oytktk 代码尾
复制代码


7. topicadmin.php

查找

  1. showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'),
复制代码

上面加

  1.   require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.         updatecache('newthread');
复制代码


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


下面加

  1. <div class="maintable">
  2.         {template toplist}
  3.         </div>
复制代码


上传 附件里的 TOPLIST.htm到模版风格目录

千万记得更新缓存 !!

关于需要缩放按钮的朋友修改以下地方

在toplist.htm里面查找
  1. <td colspan="4" align="center" class="header">
复制代码

后面加
  1. <p align="left"><a href="index.php" onclick="toggle_collapse

  2. ('category_hk2');"><img id="category_hk2_img" src="{IMGDIR}/$categorys_hk2" align="right" border="0"></a>
复制代码


有些朋友如果想每个格子里面显示的条数为自己设定值得话,请修改如下地方
打开include/cache.func.php
查找

  1. $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 10";
复制代码

  1. $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1'  ORDER BY t.lastpost DESC LIMIT 0, 10";
复制代码

  1. $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 10";
复制代码

  1. $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 10";
复制代码

分别将里面的
  1. 10
复制代码

替换成你想要数字

[ 本帖最后由 scropion~ 于 2006-3-5 15:48 编辑 ]

评分

1

查看全部评分

xjbl 发表于 2006-3-3 00:08:19 | 显示全部楼层
哦.
回复

使用道具 举报

xjbl 发表于 2006-3-3 00:08:54 | 显示全部楼层
试试哈..
回复

使用道具 举报

红色公牛 发表于 2006-3-3 00:15:41 | 显示全部楼层
地板也不错~
实在是太好了!谢谢~
回复

使用道具 举报

alantam 发表于 2006-3-3 00:20:31 | 显示全部楼层
一直想要个教程!

想要调用“发贴榜、最新发贴、最新回复、随机精华”最多人浏览那个长期不变,觉得没有什么意思!
回复

使用道具 举报

xjbl 发表于 2006-3-3 00:36:18 | 显示全部楼层

回复 #1 scropion~ 的帖子

不能缩放了..
回复

使用道具 举报

 楼主| scropion~ 发表于 2006-3-3 00:39:59 | 显示全部楼层
原帖由 xjbl 于 2006-3-3 00:36 发表
不能缩放了..

自己在TOPLIST里面改一下吧 赫赫
回复

使用道具 举报

xjbl 发表于 2006-3-3 01:18:16 | 显示全部楼层

回复 #7 scropion~ 的帖子

怎么把qihoo这个加入?
回复

使用道具 举报

 楼主| scropion~ 发表于 2006-3-3 01:27:38 | 显示全部楼层
原帖由 xjbl 于 2006-3-3 01:18 发表
怎么把qihoo这个加入?

后台有开关 打开就行了
回复

使用道具 举报

风之夜 发表于 2006-3-3 01:36:30 | 显示全部楼层
拿了再试,哎~~又有得忙了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-26 16:13 , Processed in 0.172543 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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