AGAMES 討論區

標題: 首頁四格+TOP10 for Dz7 [打印本頁]

作者: dlalden    時間: 2009-1-21 20:36:39     標題: 首頁四格+TOP10 for Dz7

插件名稱         首頁四格+今日Top10
適用版本         Discuz!7.0
語言編碼         big 5
插件作者         體無完膚
插件繁化         henryplus
版權所屬         http://www.dishack.com/
支持網站         http://www.dishack.com/
插件簡介         首頁四格+今日Top10

演示: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. <!-- 首頁五格代碼結束 -->
複製代碼



安裝包(除了已修改的file外..其他全部upload)

更新緩存,OK!

演示圖:

作者: peter080804    時間: 2009-2-7 09:16:59

使用後,≡ 論壇圖片 ≡ 一直無法顯示圖片。請問問題出在哪呢?
作者: dlalden    時間: 2009-2-7 09:25:18     標題: 回覆 2樓 peter080804 的帖子

你個論壇在任何版塊只要有圖片(要上載左),佢就會自動顯示!
作者: peter080804    時間: 2009-2-7 09:46:41

感謝您!已經成功了!
作者: carlos1688    時間: 2009-4-16 15:59:20

你好啊. 雖然可以顯示. 但中文字卻是亂碼....有什麼辦法補救?:'(
作者: dlalden    時間: 2009-4-16 16:15:11     標題: 回覆 5樓 carlos1688 的帖子

依個插件係屬於big 5,如果你話係亂碼,咁你個論壇一定係uft8!咁你要反安裝,再找番個uft8既首頁四格!
作者: carlos1688    時間: 2009-4-18 17:02:00

我將d亂碼改成英文. 都可以用. 但圖片一定是要上載才可顯示嗎?
作者: dlalden    時間: 2009-4-18 17:58:24     標題: 回覆 7樓 carlos1688 的帖子

圖片會自動出現的!只要你在論壇任何一個版塊上載圖片,它就會有圖片出現!
作者: carlos1688    時間: 2009-4-20 19:20:45

我試過上傳了. 但也沒有顯示. 是否不是big5 所以顯示不到呢....:'(
作者: dlalden    時間: 2009-4-20 21:32:38     標題: 回覆 9樓 carlos1688 的帖子

好大可能是!你試下用番uft8
作者: dlalden    時間: 2009-4-20 21:32:43     標題: 回覆 9樓 carlos1688 的帖子

好大可能是!你試下用番uft8




歡迎光臨 AGAMES 討論區 (http://forum.agames.hk/) Powered by Discuz! X2