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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[Discuz!7.0模板] [DisHack.Com资源站出品]Discuz!7.0首页四格+今日Top10

 关闭 [复制链接]
体无完肤 发表于 2008-11-25 04:38:32 | 显示全部楼层 |阅读模式
插件发布
插件名称: 首页四格+今日Top10
插件来源:
适用版本: Discuz! 7.0
语言编码: GBK简体 
最后更新时间:
插件作者: 体无完肤
插件简介: 首页四格+今日Top10
本帖最后由 下砂 于 2008-12-8 10:56 编辑

Www.DisHack.Com
做最好的Discuz!7.0资源站


演示:www.efangbbs.com

安装步骤:

懒人覆盖安装:下载附件,将包内文件按照对应目录上传覆盖即可!

手动修改安装:修改文件index.php和discuz.htm

打开index.php文件,查找:

  1. $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码
下面加:
  1. //----首页五格代码开始
  2. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  3. //新贴
  4. $hack_cut_str = 28; //标题字数
  5. $hack_cut_strauthor = 9;
  6. $new_post_threadlist = array();
  7. $nthread = array();
  8. $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");
  9. while($nthread = $db->fetch_array($query)) {
  10. $nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
  11. $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
  12. $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
  13. $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
  14. $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
  15. if($nthread['highlight']) {
  16. $string = sprintf('%02d', $nthread['highlight']);
  17. $stylestr = sprintf('%03b', $string[0]);
  18. $nthread['highlight'] = 'style="';
  19. $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  20. $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  21. $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  22. $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  23. $nthread['highlight'] .= '"';
  24. } else {
  25. $nthread['highlight'] = '';
  26. }
  27. $new_post_threadlist[] = $nthread;
  28. }

  29. //新回复
  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 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 10");
  35. while($rthread = $db->fetch_array($query)) {
  36. $rthread['forumname'] = ereg_replace('<[^>]*>','',$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. //热帖
  56. $hack_cut_str = 30; //标题字数
  57. $hack_cut_strauthor = 9;
  58. $new_hot_threadlist = array();
  59. $mthread = array();
  60. $ctime=$timestamp-3600*24*7;//最后7是天数为本周
  61. $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 AND t.dateline>$ctime AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
  62. while($mthread = $db->fetch_array($query)) {
  63. $mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
  64. $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
  65. $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
  66. $mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
  67. $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
  68. if($mthread['highlight']) {
  69. $string = sprintf('%02d', $mthread['highlight']);
  70. $stylestr = sprintf('%03b', $string[0]);
  71. $mthread['highlight'] = 'style="';
  72. $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  73. $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  74. $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  75. $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  76. $mthread['highlight'] .= '"';
  77. } else {
  78. $mthread['highlight'] = '';
  79. }
  80. $new_hot_threadlist[] = $mthread;
  81. }

  82. //今日发贴排行
  83. $tomonth=date(n);
  84. $todate=date(j);
  85. $toyear=date(Y);
  86. $time=mktime(0,0,0,$tomonth,$todate,$toyear);
  87. $query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
  88. while($result=$db->fetch_array($query)){
  89. $poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],8)."</a><font color=red>[".$result[num]."]</font>  ";
  90. }
  91. //----首页五格代码结束
复制代码
打开discuz.htm文件,查找:

  1.   function announcementScrollnext(time) {
  2.    $('annbody').scrollTop++;
  3.    anncount++;
  4.    if(anncount != time) {
  5.     annst = setTimeout('announcementScrollnext(' + time + ')', 10);
  6.    } else {
  7.     annrowcount++;
  8.     annst = setTimeout('announcementScroll()', anndelay);
  9.    }
  10.   }
  11. </script>
  12. <!--{/if}-->
  13. </div>
复制代码
下面加:

  1. <!-- 首页五格代码开始 -->
  2. <div class="mainbox forumlist" style="padding:0;">
  3. <table cellspacing="0" cellpadding="0">
  4.   <thead class="category">
  5.   <tr>
  6.    <td align="center" style="padding:0 1px 0 0"><h3>≡ 论坛图片 ≡</h3></td>
  7.    <td align="center" style="padding:0"><h3>≡ 最新帖子 ≡</h3></td>
  8.    <td align="center" style="padding:0 1px 0 1px"><h3>≡ 最新回复 ≡</h3></td>
  9.    <td align="center" style="padding:0"><h3>≡ 本周热门 ≡</h3></td>
  10.    <td></td>
  11.   </tr>
  12.   </thead>
  13.   <tr>
  14.    <td width="24%">
  15.     <script type="text/javascript" src="pic.php"></script>
  16.    </td>
  17.    <td width="25%">
  18.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  19.      <tr valign="top">
  20.       <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  21.       <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
  22.       <!--{loop $new_post_threadlist $nthread}-->
  23.        <!--{if $nthread[replies]}-->
  24.         <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}最后回复: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]'>$nthread[view_subject]</a></div>
  25.                    <!--{else}-->
  26.         <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='最新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}最后回复: 暂时没有回复'>$nthread[view_subject]</a></div>
  27.        <!--{/if}-->
  28.       <!--{/loop}-->
  29.       </td>
  30.      </tr>
  31.     </table>
  32.    </td>
  33.    <td width="25%">
  34.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  35.      <tr valign="top">
  36.       <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  37.       <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
  38.       <!--{loop $new_reply_threadlist $rthread}-->
  39.        <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title='最新回复 {LF}所在论坛: $rthread[forumname]{LF}主题标题: $rthread[subject]{LF}主题作者: $rthread[author]{LF}发表时间: $rthread[date]{LF}浏览次数: $rthread[views] 次{LF}回复次数: $rthread[replies] 次{LF}最后回复: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></div>
  40.       <!--{/loop}-->
  41.       </td>
  42.      </tr>
  43.     </table>
  44.    </td>
  45.    <td width="26%">
  46.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  47.      <tr valign="top">
  48.       <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  49.       <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
  50.       <!--{loop $new_hot_threadlist $mthread}-->
  51.        <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$mthread[tid]" $mthread['highlight'] title='本周热门 {LF}所在论坛: $mthread[forumname]{LF}主题标题: $mthread[subject]{LF}主题作者: $mthread[author]{LF}发表时间: $mthread[date]{LF}浏览次数: $mthread[views] 次{LF}回复次数: $mthread[replies] 次{LF}最后回复: $mthread[lastreplytime]{LF}{lang lastpost}: $mthread[lastposter]'>$mthread[view_subject]</a></div>
  52.       <!--{/loop}-->
  53.       </td>
  54.      </tr>
  55.     </table>
  56.    </td>
  57.    <td>
  58.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  59.      <tr valign="top">
  60.       <td></td>
  61.       <td>
  62.       
  63.       </td>
  64.      </tr>
  65.     </table>
  66.    </td>
  67.   </tr>
  68. </table>

  69. <table cellspacing="2" cellpadding="2">
  70. <tr>
  71. <td><font color=red><b>Top10: </b></font>$poststar</td>
  72. </tr>
  73. </table>
  74. </div>
  75. <!-- 首页五格代码结束 -->
复制代码
更新缓存,OK!

本帖子中包含更多资源

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

x

评分

4

查看全部评分

b890852 发表于 2008-11-25 05:17:04 | 显示全部楼层
thank you
回复

使用道具 举报

stratar.com 发表于 2008-11-25 06:17:29 | 显示全部楼层
收藏了,谢谢分享
回复

使用道具 举报

Discuz!12.0 发表于 2008-11-25 06:58:46 | 显示全部楼层
楼主的演示:www.efangbbs.com
无法打开!
你到底想搞什么名堂?
回复

使用道具 举报

beien 发表于 2008-11-25 08:16:56 | 显示全部楼层
本帖最后由 beien 于 2008-11-25 08:37 编辑
楼主的演示:www.efangbbs.com
无法打开!
你到底想搞什么名堂?
Discuz!12.0 发表于 2008-11-25 06:58



复制到IE地址栏就行了!少了http://

看帖要顶!

Www.DisHack.Com
做最好的Discuz!7.0资源站
回复

使用道具 举报

abcnic1 发表于 2008-11-25 08:43:41 | 显示全部楼层
不错 支持了
回复

使用道具 举报

生产力 发表于 2008-11-25 09:10:28 | 显示全部楼层
感谢分享,收藏备用
回复

使用道具 举报

北极雪人 发表于 2008-11-25 09:23:11 | 显示全部楼层
终于找到了,相当好用谢谢了
回复

使用道具 举报

kentcn 发表于 2008-11-25 09:26:27 | 显示全部楼层
喜欢折叠式的。可惜一个都没放出!
回复

使用道具 举报

 楼主| 体无完肤 发表于 2008-11-25 09:49:37 | 显示全部楼层
9# kentcn


以后慢慢修改!  呵呵
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 06:50 , Processed in 0.108947 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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