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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 超炫的首页三格(Flash图片+最新话题+最新回复)for 5.5

[复制链接]
mousecat 发表于 2007-3-28 12:20:28 | 显示全部楼层 |阅读模式
===============================================

插件演示:    牡丹园外-吉林大学校友联谊会
插件版本:    Discuz! 5.5.0  GBK 简体中文正式版
插件质量:    首发beta测试版
安装难易:    易
数据库表:    无
修改文件:    index.php,discuz.htm, css.htm
增加文件:    toplist.htm images/default/toplist
插件作者:    mousecat
发布理由:    很多人要,自己也很喜欢

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

文件修改:

1。修改index.php

查找:
  1. require_once DISCUZ_ROOT.'./include/forum.func.php';
复制代码


下面添加:
  1. require_once DISCUZ_ROOT.'./include/misc.func.php';
复制代码


继续找:
  1. $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码


下面添加:
  1. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  2. //最新话题 toplist by mousecat starts//
  3. $hack_cut_str =28; //修改标题显示字数
  4. $hack_cut_strauthor = 9;
  5. $new_post_threadlist = array();
  6. $nthread = array();
  7. $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 8");
  8. while($nthread = $db->fetch_array($query)) {
  9.         $nthread['forumname'] = $nthread['name'];
  10.         $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
  11.         $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
  12.         $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
  13.         $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
  14.         if($nthread['highlight']) {
  15.                 $string = sprintf('%02d', $nthread['highlight']);
  16.                 $stylestr = sprintf('%03b', $string[0]);
  17.                 $nthread['highlight'] = 'style="';
  18.                 $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  19.                 $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  20.                 $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  21.                 $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  22.                 $nthread['highlight'] .= '"';
  23.         } else {
  24.                 $nthread['highlight'] = '';
  25.         }
  26.         $new_post_threadlist[] = $nthread;
  27. }
  28. //最新话题 toplist by mousecat ends//
  29. //最新回复 toplist by mousecat starts//
  30. $hack_cut_str = 28; //修改标题显示字数
  31. $hack_cut_strauthor = 9;
  32. $new_reply_threadlist = array();
  33. $rthread = array();
  34. $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid  AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 8");
  35. while($rthread = $db->fetch_array($query)) {
  36.         $rthread['forumname'] = $rthread['name'];
  37.         $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
  38.         $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
  39. $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
  40.         $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
  41.         if($rthread['highlight']) {
  42.                 $string = sprintf('%02d', $rthread['highlight']);
  43.                 $stylestr = sprintf('%03b', $string[0]);
  44.                 $rthread['highlight'] = 'style="';
  45.                 $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  46.                 $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  47.                 $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  48.                 $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  49.                 $rthread['highlight'] .= '"';
  50.         } else {
  51.                 $rthread['highlight'] = '';
  52.         }
  53.         $new_reply_threadlist[] = $rthread;
  54. }
  55. //最新回复 toplist by mousecat ends//
复制代码


2. 打开/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}-->
复制代码


3. 打开/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*/
复制代码


4. 上传附件中的文件到相应的文件夹

5。后台更新缓存

结束!

[ 本帖最后由 mousecat 于 2007-3-28 13:20 编辑 ]
 楼主| mousecat 发表于 2007-3-28 12:20:44 | 显示全部楼层
:) 漂亮的首页三格(Flash图片+最新话题+最新回复)for 5.5

效果展示:


[ 本帖最后由 mousecat 于 2007-3-28 13:01 编辑 ]
回复

使用道具 举报

 楼主| mousecat 发表于 2007-3-28 12:21:06 | 显示全部楼层
使用说明:

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的支持
看这个帖子:
https://discuz.dismall.com/viewth ... &extra=page%3D3
看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-28 12:21:22 | 显示全部楼层
漂亮的首页三格(Flash图片+最新话题+最新回复)for 5.5

自己留着用这层楼

这个不是用cache版本的。
cache版看这里:https://discuz.dismall.com/thread-573285-1-1.html

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

使用道具 举报

bluelads 发表于 2007-3-28 12:23:22 | 显示全部楼层
回复

使用道具 举报

 楼主| mousecat 发表于 2007-3-28 12:27:24 | 显示全部楼层
楼上的,看看我的,和你不一样(可能还比你的漂亮一点)
回复

使用道具 举报

bluelads 发表于 2007-3-28 12:34:04 | 显示全部楼层
显示不出图片。。 
回复

使用道具 举报

净鬼 发表于 2007-3-28 12:56:57 | 显示全部楼层
不完整.....    LZ是不是根本就不准备发....
回复

使用道具 举报

bluelads 发表于 2007-3-28 13:01:10 | 显示全部楼层
回复

使用道具 举报

tomato279 发表于 2007-3-28 13:05:53 | 显示全部楼层
关注一下,...............
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-22 11:35 , Processed in 0.105114 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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