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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] Discuz! 5.0.0 RC1首页四格cache+社区明星

[复制链接]
xise 发表于 2006-7-21 18:00:25 | 显示全部楼层 |阅读模式
本人修改于以下朋友4.1的作品
插件名称:整合首页四格cache+社区发贴之星后台控制全Cache版 FOR DZ4.1正式版
插件修改:
插件原作者:33201,oytktk (靖飒),scropion~,mousecat
数据库升级:有
安装难度:中

插件演示地址:http://www.kfyes.com/bbs/

整合了首页四格cache版和社区法帖之星,可以在后台开启关闭相关版面。

装插件需要耐心,慢慢看仔细看,在仔细做,就不会出错

全新安装:()

1。首先安装:

TOPLIST_首页四格_全Cache版FOR DZ4.1.0 原插件由 oytktk (靖飒) 制作,the 4.1.0 edition is modified by apple123.net

按照步骤安装 地址: https://discuz.dismall.com/viewthread.php?tid=247056

先不要上传原贴所带附件、不要修改index.php、index.htm,

2。然后安装:

社区发贴之星(今日+昨日+本周+本月+本年)后台控制全Cache版 FOR DZ4.1正式版

插件作者:33201

按照步骤安装 地址: https://discuz.dismall.com/thread-277742-1-1.html

先不要上传原贴所带附件、不要修改index.php、index.htm

3。下面开始修改 discuz.php。
查找
  1. require_once DISCUZ_ROOT.'./include/forum.func.php';
复制代码


下面添加
require_once DISCUZ_ROOT.'./forumdata/cache/cache_poststar.php';
$month=date(n);
$year=date(Y);


查找
unset($_DCACHE['announcements']);


下面添加

//========== 社区明星BY 33201 开始
$nopoststar ='<td width=17%>姓名:<font color=red><b> 虚位以待!</b></font> <br>UID  :<b>空</b> <br>积分:空 <br>精华:空<br>今日发帖:空<br>总发帖量:空<br> 在线时间:空 <br> </td><td width=16% align=center class=altbg1><img src=images/nopic.gif width=80 height=80 align=center></td>';
    if($_DCACHE['daystar']) {
                foreach($_DCACHE['daystar'] as $key => $dstar) {
            if ($key<3){
                $daystars .="<td width=17%>姓名:<b>".$dstar[author]."</b> <br>UID  :<b>".$dstar[authorid]."</b> <br>积分:".$dstar[credits]." <br>精华:".$dstar[digestposts]." 篇<br><font color=red><b>今日</b></font>发帖:<font color=red><b>".$dstar[num]."</b></font> 篇<br>总发帖量:".$dstar[posts]." 篇<br> 在线时间:".$dstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$dstar[avatar]." width=".$dstar[avatarwidth]." height=".$dstar[avatarheight]." align=center></td>";$n=$key;
}
                }
if($n==0){$nostar .=$nopoststar.$nopoststar;}elseif($n==1){$nostar .=$nopoststar;}
        }
    if($_DCACHE['weekstar']) {
                foreach($_DCACHE['weekstar'] as $key => $wstar) {
            if ($key<3){
                $weekstars .="<td width=17%>姓名:<b>".$wstar[author]."</b> <br>UID  :<b>".$wstar[authorid]."</b> <br>积分:".$wstar[credits]." <br>精华:".$wstar[digestposts]." 篇<br><font color=red><b>本周</b></font>发帖:<font color=red><b>".$wstar[num]."</b></font> 篇<br>总发帖量:".$wstar[posts]." 篇<br> 在线时间:".$wstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$wstar[avatar]." width=".$wstar[avatarwidth]." height=".$wstar[avatarheight]." align=center></td>";$weeknum=$key;
            }
                }
if($weeknum==0){$noweekstar .=$nopoststar.$nopoststar;}elseif($weeknum==1){$noweekstar .=$nopoststar;}
        }
    if($_DCACHE['monthstar']) {
                foreach($_DCACHE['monthstar'] as $key => $mstar) {
            if ($key<3){
                $monthstars .="<td width=17%>姓名:<b>".$mstar[author]."</b> <br>UID  :<b>".$mstar[authorid]."</b> <br>积分:".$mstar[credits]." <br>精华:".$mstar[digestposts]." 篇<br><font color=red><b>".$month."月</b></font>发帖:<font color=red><b>".$mstar[num]."</b></font> 篇<br>总发帖量:".$mstar[posts]." 篇<br> 在线时间:".$mstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$mstar[avatar]." width=".$mstar[avatarwidth]." height=".$mstar[avatarheight]." align=center></td>";
            }
                }
        }
    if($_DCACHE['yearstar']) {
                foreach($_DCACHE['yearstar'] as $key => $ystar) {
            if ($key<3){
                $yearstars .="<td width=17%>姓名:<b>".$ystar[author]."</b> <br>UID  :<b>".$ystar[authorid]."</b> <br>积分:".$ystar[credits]." <br>精华:".$ystar[digestposts]." 篇<br><font color=red><b>".$year."年</b></font>发帖:<font color=red><b>".$ystar[num]."</b></font> 篇<br>总发帖量:".$ystar[posts]." 篇<br> 在线时间:".$ystar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$ystar[avatar]." width=".$ystar[avatarwidth]." height=".$ystar[avatarheight]." align=center></td>";
            }
                }
        }
//==========社区明星BY 33201 结束


查找
$threads = $posts = $todayposts = 0;


下面添加

//首页四格TOPLIST_CACHE版, By oytktk 代码首
        if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_hk2 ') === FALSE) {
                $categorys_hk2 = 'collapsed_no.gif';
                $collapse['category_hk2'] = '';
        } else {
                $categorys_hk2 = 'collapsed_yes.gif';
                $collapse['category_hk2'] = 'display: none';
        }
        
        if($categorys_hk2 == 'collapsed_no.gif'){
        require_once DISCUZ_ROOT.'./forumdata/cache/cache_toplist.php';
        $toplistloop = $_DCACHE['newthread'];
        }
        //首页四格TOPLIST_CACHE版, By oytktk 代码尾



4.下面开始修改相应模版目录下面的 discuz.htm

查找
<!--{if !empty($newpmexists)}-->
        <div class="maintable">
        {template pmprompt}
        </div>
<!--{/if}-->


下面添加(因为本人没有做后台控制测试所以下面的代码是不做后台控制的代码)

<!--{if empty($gid)}-->
<div class="maintable">
{template toplist}
</div>
<!--{/if}-->


如果装了后台的可以试试下面的
<!--{if empty($gid)}-->
<!--{if $show_poststar}-->
<div class="maintable">
{template toplist}
</div>
<!--{/if}-->
<!--{/if}-->


5上传附件完(别忘了装好后更新后台缓存不然不会显示和出现错误)




出现比例不协调,把格子撑开的请看下面
首页四格的修改中第2步修改include/cache.func.php时,在这一步:


//首页四格TOPLIST_CACHE版, By oytktk 代码首

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

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

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

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


                //首页四格TOPLIST_CACHE版, By oytktk 代码尾


修改

$topthread['subjectc'] = cutstr($topthread['subject'],


把其中的后面的数字(例如28)为你需要的字节数即可,一般把数字改的小一点,一共需要修改四处。

然后更新缓存!

其它问题参考https://discuz.dismall.com/thread-292969-1-1.html

[ 本帖最后由 xise 于 2006-7-26 11:46 编辑 ]

本帖子中包含更多资源

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

x
yinfoo 发表于 2006-7-21 18:15:02 | 显示全部楼层
3Q
回复

使用道具 举报

aboutcms 发表于 2006-7-21 18:19:21 | 显示全部楼层
顶好
回复

使用道具 举报

liubingf 发表于 2006-7-21 19:31:07 | 显示全部楼层
板凳!!
回复

使用道具 举报

modos 发表于 2006-7-21 21:03:12 | 显示全部楼层
有问题,不能装出错。。。

  1. Parse error: syntax error, unexpected T_STRING in E:\website\modos\bbs.wedsh.com\include\cache.func.php on line 180
复制代码
回复

使用道具 举报

AriBaba 发表于 2006-7-21 21:06:17 | 显示全部楼层
收藏起來
回复

使用道具 举报

hbpin 发表于 2006-7-21 21:56:15 | 显示全部楼层
先支持下,有人成功不?
回复

使用道具 举报

big888 发表于 2006-7-21 22:44:57 | 显示全部楼层
做記號
感恩喔..
回复

使用道具 举报

QQASP 发表于 2006-7-22 02:17:25 | 显示全部楼层
我也做个记号!
回复

使用道具 举报

yhion 发表于 2006-7-22 05:01:28 | 显示全部楼层
不错不错,感谢,我成功了....不过有点累
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-2 02:34 , Processed in 0.290158 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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