找回密码
 注册
查看: 3541|回复: 9
收起左侧

首页四格 for discuz7.1正式版

  [复制链接]

5312

主题

8317

帖子

1万

积分

管理员

出售国内外虚拟空间

Rank: 10Rank: 10Rank: 10

积分
14660
帖子
8317
精华
67
体力
14660 点
蓝豆
2391 点
注册时间
2007-6-8

终身成就奖LY官方团队会员身份ID卡

发表于 2009-10-17 13:14:43 | 显示全部楼层 |阅读模式
打开include/index_classics.inc.php,查找:
  1. $memberenc = rawurlencode($lastmember);
  2. $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码
下面加上以下代码:
  1. //----首页四格代码开始
  2. $colorarray = array(, red, orange, yellow, green, cyan, blue, purple, gray, magenta);
  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;//最后30是天数为本月
  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 = 30; //标题字数
  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, 9");
  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. //----首页四格代码结束
复制代码
接着修改templates/default/Discuz.htm文件, 查找:
  1. <!--{eval $rkey=array_rand($catlist);}-->
复制代码
在上面加入以下代码:
  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"><h3>≡ 最新帖子 ≡</h3></td>
  7. <td align="center" style="padding:0 1px 0 1px"><h3>≡ 最新回复 ≡</h3></td>
  8. <td align="center" style="padding:0 1px 0 0"><h3>≡ 本周热门 ≡</h3></td>
  9. <td align="center" style="padding:0"><h3>≡ 论坛精华 ≡</h3></td>
  10. </tr>
  11. </thead>
  12. <tr>
  13. <td width="16%">
  14. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  15. <tr valign="top">
  16. <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  17. <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat" width="100%">
  18. <!--{loop $new_post_threadlist $nthread}-->
  19. <!--{if $nthread[replies]}-->
  20. <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>
  21. <!--{else}-->
  22. <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>
  23. <!--{/if}-->
  24. <!--{/loop}-->
  25. </td>
  26. </tr>
  27. </table>
  28. </td>
  29. <td width="16%">
  30. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  31. <tr valign="top">
  32. <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  33. <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat" width="100%">
  34. <!--{loop $new_reply_threadlist $rthread}-->
  35. <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>
  36. <!--{/loop}-->
  37. </td>
  38. </tr>
  39. </table>
  40. </td>
  41. </td>
  42. <td width="16%">
  43. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  44. <tr valign="top">
  45. <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  46. <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat" width="100%">
  47. <!--{loop $new_hot_threadlist $mthread}-->
  48. <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>
  49. <!--{/loop}-->
  50. </td>
  51. </tr>
  52. </table>
  53. </td>
  54. <td width="16%">
  55. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  56. <tr valign="top">
  57. <td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
  58. <td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat" width="100%">
  59. <!--{loop $new_digest_threadlist $dthread}-->
  60. <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>
  61. <!--{/loop}-->
  62. </td>
  63. </tr>
  64. </table>
  65. </td>
  66. </tr>
  67. </table>
  68. </div>
  69. <!-- 首页四格代码结束 -->
复制代码
游客,如果您要查看本帖隐藏内容请回复
出售国内或美国高性能虚拟空间,高速VPS以及服务器! 同时承接各种类型的网站制作,网站维护,支付宝交易安全放心!    联系QQ:6102031
懒得打字嘛,点击右侧快捷回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

网站公告上一条 /2 下一条

GMT+8, 2024-4-29 11:12 , Processed in 0.093750 second(s), 24 queries , Gzip On.

© 2006-2022 Powered by Discuz! X3.4

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