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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

首页五格(论坛图片、最新帖子、最新回复、本周热门、本月精华)For Discuz!6.1 GBK

[复制链接]
罗尼奥沙利文 发表于 2008-6-26 23:30:22 | 显示全部楼层 |阅读模式
插件发布
插件名称: 首页五格(论坛图片、最新帖子、最新回复、本周热门、本月精华)
插件来源:
适用版本: Discuz! 6.1
语言编码: GBK简体 
最后更新时间:
插件作者: 罗尼奥沙利文
插件简介: 首页五格(论坛图片、最新帖子、最新回复、本周热门、本月精华)For Discuz!6.1 GBK
本帖最后由 罗尼奥沙利文 于 2009-2-20 22:57 编辑

近日论坛刚刚升级,找了许多首页N格都不怎么喜欢,于是只能耐着性子自己做,测试之后感觉还不错,就发出来跟大家一起分享,第一次发布插件,哈哈,希望大家能够支持,谢谢啦!

演示网站:杨紫后援会 http://www.yangzi116.com/bbs/

杨紫后援会|发布杨紫|最新消息|最新视频|最新图片|紫米互动平台|支持杨紫源动力!

好了,废话到此为止,下面切入正题!

操作方法如下:
1、把下面附件压缩包内的images 文件传到论坛相应文件夹里面;

(下面为重要步骤,请做好原文件备份)

2、修改论坛根目录下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 = 20; //标题字数
  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 = 20; //标题字数
  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 = 20; //标题字数
  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. $hack_cut_str = 20; //标题字数
  84. $hack_cut_strauthor = 9;
  85. $new_digest_threadlist = array();
  86. $dthread = array();
  87. $dtime=$timestamp-3600*24*30;//最后30是天数为本月
  88. $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>$dtime AND t.digest in (1,2,3) AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
  89. while($dthread = $db->fetch_array($query)) {
  90. $dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
  91. $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
  92. $dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
  93. $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
  94. $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
  95. if($dthread['highlight']) {
  96. $string = sprintf('%02d', $dthread['highlight']);
  97. $stylestr = sprintf('%03b', $string[0]);
  98. $dthread['highlight'] = 'style="';
  99. $dthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  100. $dthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  101. $dthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  102. $dthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  103. $dthread['highlight'] .= '"';
  104. } else {
  105. $dthread['highlight'] = '';
  106. }
  107. $new_digest_threadlist[] = $dthread;
  108. }
  109. //----首页五格代码结束
复制代码
3、修改templates\default\下discuz.htm文件,找到:
  1. <!--{if !empty($insenz['vfstatus'])}--><script type="text/javascript" src="campaign.php?action=list"></script><!--{/if}-->
复制代码
在下面添加:
  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 1px 0 0"><h3>≡ 本周热门 ≡</h3></td>  
  10.    <td align="center" style="padding:0"><h3>≡ 本月精华 ≡</h3></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="15%">
  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="15%">
  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="15%">
  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 width="15%">
  58.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  59.      <tr valign="top">
  60.       <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  61.       <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
  62.       <!--{loop $new_digest_threadlist $dthread}-->
  63.        <div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$dthread[tid]" $dthread['highlight'] title='本月精华 {LF}所在论坛: $dthread[forumname]{LF}主题标题: $dthread[subject]{LF}主题作者: $dthread[author]{LF}发表时间: $dthread[date]{LF}浏览次数: $dthread[views] 次{LF}回复次数: $dthread[replies] 次{LF}最后回复: $dthread[lastreplytime]{LF}{lang lastpost}: $dthread[lastposter]'>$dthread[view_subject]</a></div>
  64.       <!--{/loop}-->
  65.       </td>
  66.      </tr>
  67.     </table>
  68.    </td>
  69.   </tr>
  70. </table>
  71. </div>
  72. <!-- 首页五格代码结束 -->
复制代码
4、上传刚刚修改完的index.php和discuz.htm文件

5、上传pic.php(直接上传)

如果你没有手动修改过上面这两个文件,就可以下载附件解压后上传到相应目录直接覆盖!

[ 本帖最后由 罗尼奥沙利文 于 2008-7-3 14:29 编辑 ]

评分

1

查看全部评分

sgyoyome 发表于 2008-6-26 23:42:38 | 显示全部楼层
不错哦。。谢谢lz
回复

使用道具 举报

cgdzy2 发表于 2008-6-30 20:06:44 | 显示全部楼层
这几天一直在找啊,四格的不全,六格的多余,就要的你这种的,但我是用在6.0的版本上的,你这个支持6.0吗

强顶楼主

看我的站http://at186.cn/bbs

最后一格发帖排行根本就是多余,不想要,而你的正是我所需要的。
回复

使用道具 举报

richiejen 发表于 2008-6-30 20:10:19 | 显示全部楼层
不是CACHE版,唉~
回复

使用道具 举报

cgdzy2 发表于 2008-6-30 20:14:14 | 显示全部楼层
原帖由 richiejen 于 2008-6-30 20:10 发表
不是CACHE版,唉~



CACHE版啥意思
回复

使用道具 举报

85571223 发表于 2008-7-1 16:19:36 | 显示全部楼层
我装了四格的,如何装你这个。。。。。。。要先删四格的?
回复

使用道具 举报

h0138197 发表于 2008-7-3 07:45:01 | 显示全部楼层
http://yepao.dx.ffdiy.net/bbs/
手动修改了你的不显示图片.....!!!!我上传1张不显示·请指教
QQ 842981
回复

使用道具 举报

h0138197 发表于 2008-7-3 07:48:06 | 显示全部楼层
另外我查了你的代码查找了
找不到focus.swf这个文件~~我装了以后也没显示出来··麻烦楼主能够帮忙解决·(::97::)
回复

使用道具 举报

xinhai168 发表于 2008-7-3 10:38:37 | 显示全部楼层
你的附件中缺少pic.php,放出来吧。
回复

使用道具 举报

h0138197 发表于 2008-7-3 11:11:23 | 显示全部楼层
汗~~楼主竟然私藏~~~!
快快把PIC.php文件放出来哦!
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-20 00:00 , Processed in 0.465144 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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