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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 超炫的首页三格(Flash图片+最新话题+最新回复)for 5.5 cache版,4月2日更新

[复制链接]
mousecat 发表于 2007-3-29 00:11:32 | 显示全部楼层 |阅读模式
========================================================

插件演示:    加拿大滑铁卢大学中国学生学者联谊会
插件版本:    Discuz! 5.5.0  GBK+UTF 中文beta版
插件质量:    首发beta测试版
安装难易:    中
数据库表:    无
修改文件:    cache.func.php, editpost.inc.php, newreply.inc.php, newthread.inc.php,
                     topicadmin.php,index.php,discuz.htm, css.htm
增加文件:    toplist.htm images/default/toplist
插件作者:    mousecat
发布理由:    很多人要,自己也很喜欢,做了一个cache版的,给那些不喜欢增加查询的

========================================================

文件修改开始:

1。打开include/cache.func.php

查找
  1. 'medals'        => array('medals')
复制代码


上面加
  1.                 'toplist'   => array('newthread', 'newreply'),//TOPLIST_首页3格_全Cache版_by mousecat
复制代码


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


上面加
  1. //首页3格TOPLIST_CACHE版_by mousecat starts
  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, 8";
  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, 8";
  11.                                 break;
  12. //首页3格TOPLIST_CACHE版_by mousecat ends
复制代码


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


上面加
  1. //首页3格TOPLIST_CACHE版_by mousecat starts
  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'], 26);
  8.                                                 $topthread['threadcolor'] = $threadcolor[1] ? " style="color: ".$colorarray[$threadcolor[1]].""" : NULL;
  9.                                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $GLOBALS['timeoffset'] * 3600 );
  10.                                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $GLOBALS['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'] + $GLOBALS['timeoffset'] * 3600 );
  23.                                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $GLOBALS['timeoffset'] * 3600 );
  24.                                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  25.                                                 $data[] = $topthread;
  26.                                 }
  27.                                 break;
  28. //首页3格TOPLIST_CACHE版_by mousecat ends
复制代码


2。打开include/newthread.inc.php

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


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


3。打开 include/newreply.inc.php

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


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


4。打开 include/editpost.inc.php

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


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


5。论坛根目录 index.php

查找
  1. $threads = $posts = $todayposts = $fids = $announcepm = 0;
复制代码


下面加
  1. //首页3格TOPLIST_CACHE版_by mousecat starts
  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. //首页3格TOPLIST_CACHE版_by mousecat starts
复制代码


6。 根目录 topicadmin.php

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


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


7。templates\default\discuz.htm

查找
  1. <!--{if !empty($newpmexists) || $announcepm}-->
  2.         <div style="clear: both; margin-top: 5px" id="pmprompt">
  3.         {template pmprompt}
  4.         </div>
  5. <!--{/if}-->
复制代码


在下面添加:
  1. <!--{if empty($gid)}-->
  2.         {template toplist}
  3. <!--{/if}-->
复制代码


8. 打开/templates/default/css.htm

在最后面添加:
  1. /*TopList starts*/
  2. .toplist        {
  3. width: 98%; min-width: 770px;
  4. clear: both;
  5. padding: 4px;
  6. border-top: 1px solid #E0E0E0;
  7. border-left: 1px solid #E0E0E0;
  8. border-right: 3px solid #E0E0E0;
  9. border-bottom: 3px solid #E0E0E0;
  10. background-color: #FFF;
  11. background-repeat: repeat-x;
  12. margin-bottom: 10px;
  13. font-size: 12px;
  14. }
  15. .toplist2 {border-top: #CC3399 5px solid; clear: both; overflow: hidden}
  16. .toplist2 div {float: right; text-align: center}
  17. .lbox        {margin: 3px; padding: 3px; text-align: left}
  18. .toplistpost{
  19. border-bottom: #DDDDDD 1px dashed;
  20. padding: 4px 0 0 8px;
  21. display: block;
  22. overflow: hidden;
  23. height: 19px;
  24. text-align: left;
  25. }
  26. /*TopList ends*/
复制代码


9。 上传附件中的文件到相应的文件夹

10。后台更新缓存

结束!

utf版下载:
GBK版下载:
改好的,支持firefox的版本: by chino,我没有测试

[ 本帖最后由 mousecat 于 2007-4-3 00:49 编辑 ]

本帖子中包含更多资源

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

x

评分

1

查看全部评分

 楼主| mousecat 发表于 2007-3-29 00:11:48 | 显示全部楼层
效果演示


网站演示

http://bbs.uwcssa.com/index.php

[ 本帖最后由 mousecat 于 2007-3-29 00:29 编辑 ]

本帖子中包含更多资源

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

x
回复

使用道具 举报

 楼主| mousecat 发表于 2007-3-29 00:12:15 | 显示全部楼层
使用说明:

1。如何换成自己的图片,文字和连接

在toplist.htm中,查找:

  1. linkarr[1] = "index.php";
  2. picarr[1] = "{IMGDIR}/toplist/1.jpg";
  3. textarr[1] = "测试图片效果之1";
  4. linkarr[2] = "index.php";
  5. picarr[2] = "{IMGDIR}/toplist/2.jpg";
  6. textarr[2] = "测试图片效果之2";
  7. linkarr[3] = "index.php";
  8. picarr[3] = "{IMGDIR}/toplist/3.jpg";
  9. textarr[3] = "测试图片效果之3";
  10. linkarr[4] = "index.php";
  11. picarr[4] = "{IMGDIR}/toplist/4.jpg";
  12. textarr[4] = "测试图片效果之4";
  13. linkarr[5] = "index.php";
  14. picarr[5] = "{IMGDIR}/toplist/5.jpg";
  15. textarr[5] = "测试图片效果之5";
复制代码


改成你希望的连接,和文字。把相应的图片放在images/default/toplist目录下,按照相应的排序修改名字。

2。显示问题
如果安装之后显示成为


只需要在模板toplist中寻找:
  1. <div style="float: left; width: 26%; height: 200px">
复制代码
把width: 26%改成一个合适的值就好了

3。对firefox的支持

看19楼的修改,多谢chino的提醒

4。很多人问关于修改背景颜色
看这里
  1. /*TopList starts*/
  2. .toplist        {
  3. width: 98%; min-width: 770px;
  4. clear: both;
  5. padding: 4px;
  6. border-top: 1px solid #E0E0E0; ------------------边框修饰大小及颜色
  7. border-left: 1px solid #E0E0E0; ------------------边框修饰大小及颜色
  8. border-right: 3px solid #E0E0E0; ------------------边框修饰大小及颜色
  9. border-bottom: 3px solid #E0E0E0; ------------------边框修饰大小及颜色
  10. background-color: #FFF; ------------------背景颜色
  11. background-repeat: repeat-x;
  12. margin-bottom: 10px;
  13. font-size: 12px; ------------------字体大小
  14. }
  15. .toplist2 {border-top: #CC3399 5px solid; clear: both; overflow: hidden}
  16. .toplist2 div {float: right; text-align: center}
  17. .lbox        {margin: 3px; padding: 3px; text-align: left}
  18. .toplistpost{
  19. border-bottom: #DDDDDD 1px dashed;
  20. padding: 4px 0 0 8px;
  21. display: block;
  22. overflow: hidden;
  23. height: 19px;
  24. text-align: left;
  25. }
  26. /*TopList ends*/
复制代码


5。连接不好用的问题

如果要在图片里上 URL 的话
不要使用 &extra=page%3D1 的讯息,会出错的。

举例:
  1. 如果 URL 为: [url]http://www.123456789.com/viewthread.php?tid=1234&extra=page%3D1[/url]
  2. 只需 Copy : [url]http://www.123456789.com/viewthread.php?tid=1234[/url]
  3. 来使用就可以了!
复制代码

[ 本帖最后由 mousecat 于 2007-4-3 00:36 编辑 ]
回复

使用道具 举报

 楼主| mousecat 发表于 2007-3-29 00:12:37 | 显示全部楼层
超炫的首页三格(Flash图片+最新话题+最新回复)for 5.5 cache版

这个是cache版的,这样会较少一点数据库查询。

非cache版的,看这里:https://discuz.dismall.com/thread-572520-1-2.html

[ 本帖最后由 mousecat 于 2007-3-29 00:35 编辑 ]
回复

使用道具 举报

奇跡の海 发表于 2007-3-29 00:14:14 | 显示全部楼层
?????????? 占的太夸张
回复

使用道具 举报

麦田-1979 发表于 2007-3-29 00:20:22 | 显示全部楼层
占个位置等待发布
回复

使用道具 举报

ahmas 发表于 2007-3-29 00:26:21 | 显示全部楼层
我也来占...
回复

使用道具 举报

 楼主| mousecat 发表于 2007-3-29 00:43:11 | 显示全部楼层
发完了,累死了
回复

使用道具 举报

动凡心 发表于 2007-3-29 01:49:28 | 显示全部楼层
楼主不行啊!index.php这个有问题啊!加上你的代码就上不去了!
回复

使用道具 举报

动凡心 发表于 2007-3-29 01:52:25 | 显示全部楼层
没加上还能进不过出现这样!请楼主尽快修正!谢谢!
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-22 13:30 , Processed in 0.122344 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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