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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] 【forD4.1】首页三格帖子调用(新帖+新回复+热帖/新帖+新回复+精华)+美化+作者

[复制链接]
whitegerry 发表于 2006-3-11 21:42:34 | 显示全部楼层 |阅读模式
强烈建议安装 “全Cache版” (06.6.11)

http://xxgarden.net/bbs/viewthread.php?tid=131085






此插件适合中小型论坛的修改。

原版本   :  discuz!2.5
适用版本:  discuz!4.1.0 (discuz!4.0见插件整理区)
插件作者:  alan888
插件修改:  whitegerry(老W)
修改难度:  易
数据库升级:  无

图片演示  








站点演示: http://xxgarden.net/bbs/index.php

其他相关修改见: http://xxgarden.net/bbs/viewthread.php?tid=113510

此插件会增加3个查询,看自己喜欢与否吧


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. //---------------hack Meminfo start
  2. if(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 6.0")) {
  3.                 $visitor_browser = "Internet Explorer 6.0";
  4.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 5.5")) {
  5.                 $visitor_browser = "Internet Explorer 5.5";
  6.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 5.0")) {
  7.                 $visitor_browser = "Internet Explorer 5.0";
  8.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "MSIE 4.01")) {
  9.                 $visitor_browser = "Internet Explorer 4.01";
  10.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NetCaptor")) {
  11.                 $visitor_browser = "NetCaptor";
  12.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Netscape")) {
  13.                 $visitor_browser = "Netscape";
  14.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Lynx")) {
  15.                 $visitor_browser = "Lynx";
  16.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Opera")) {
  17.                 $visitor_browser = "Opera";
  18.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Konqueror")) {
  19.                 $visitor_browser = "Konqueror";
  20.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Mozilla")) {
  21.                 $visitor_browser = "Mozilla";
  22.         } else {
  23.                 $visitor_browser = "其它";
  24.         }
  25. //上面的是浏览器//
  26.         if(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5.1")) {
  27.                 $visitor_os = "Windows XP";
  28.         }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5.2")) {
  29.                 $visitor_os = "Windows Server 2003";
  30.         }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 5")) {
  31.                 $visitor_os = "Windows 2000";
  32.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "4.9")) {
  33.                 $visitor_os = "Windows ME";
  34.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "NT 4")) {
  35.                 $visitor_os = "Windows NT 4.0";
  36.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "98")) {
  37.                 $visitor_os = "Windows 98";
  38.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "95")) {
  39.                 $visitor_os = "Windows 95";
  40.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Mac")) {
  41.                 $visitor_os = "Mac";
  42.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Linux")) {
  43.                 $visitor_os = "Linux";
  44.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "Unix")) {
  45.                 $visitor_os = "Unix";
  46.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "FreeBSD")) {
  47.                 $visitor_os = "FreeBSD";
  48.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "SunOS")) {
  49.                 $visitor_os = "SunOS";
  50.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "BeOS")) {
  51.                 $visitor_os = "BeOS";
  52.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "OS/2")) {
  53.                 $visitor_os = "OS/2";
  54.         } elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "PC")) {
  55.                 $visitor_os = "Macintosh";
  56.         }elseif(strpos($HTTP_SERVER_VARS[HTTP_USER_AGENT], "AIX")) {
  57.                 $visitor_os = "AIX";
  58.         } else {
  59.                 $visitor_os = "其他";
  60.         }

  61.         $mem_home = convertip($onlineip, $datadir = "./");
  62. //info//
  63. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  64. //新贴//
  65. $hack_cut_str =29; //修改标题显示字数
  66. $hack_cut_strauthor = 9;
  67. $new_post_threadlist = array();
  68. $nthread = array();
  69. $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, 14");
  70. while($nthread = $db->fetch_array($query)) {
  71.         $nthread['forumname'] = $nthread['name'];
  72.         $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
  73.         $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
  74.         $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
  75.         $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
  76.         if($nthread['highlight']) {
  77.                 $string = sprintf('%02d', $nthread['highlight']);
  78.                 $stylestr = sprintf('%03b', $string[0]);

  79.                 $nthread['highlight'] = 'style="';
  80.                 $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  81.                 $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  82.                 $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  83.                 $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  84.                 $nthread['highlight'] .= '"';
  85.         } else {
  86.                 $nthread['highlight'] = '';
  87.         }
  88.         $new_post_threadlist[] = $nthread;
  89. }
  90. //新贴//

  91. //新回覆
  92. $hack_cut_str = 29; //修改标题显示字数
  93. $hack_cut_strauthor = 9;
  94. $new_reply_threadlist = array();
  95. $rthread = array();
  96. $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, 14");
  97. while($rthread = $db->fetch_array($query)) {
  98.         $rthread['forumname'] = $rthread['name'];
  99.         $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
  100.         $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
  101. $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
  102.         $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
  103.         if($rthread['highlight']) {
  104.                 $string = sprintf('%02d', $rthread['highlight']);
  105.                 $stylestr = sprintf('%03b', $string[0]);

  106.                 $rthread['highlight'] = 'style="';
  107.                 $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  108.                 $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  109.                 $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  110.                 $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  111.                 $rthread['highlight'] .= '"';
  112.         } else {
  113.                 $rthread['highlight'] = '';
  114.         }
  115.         $new_reply_threadlist[] = $rthread;
  116. }
  117. //回覆//

  118. //热帖
  119. $hack_cut_str = 29; //修改标题显示字数
  120. $hack_cut_strauthor = 9;
  121. $new_hot_threadlist = array();
  122. $mthread = array();
  123. $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.replies DESC LIMIT 0, 14");
  124. while($mthread = $db->fetch_array($query)) {
  125.         $mthread['forumname'] = $mthread['name'];
  126.         $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
  127.         $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
  128. $mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
  129.         $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
  130.         if($mthread['highlight']) {
  131.                 $string = sprintf('%02d', $mthread['highlight']);
  132.                 $stylestr = sprintf('%03b', $string[0]);

  133.                 $mthread['highlight'] = 'style="';
  134.                 $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  135.                 $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  136.                 $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  137.                 $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  138.                 $mthread['highlight'] .= '"';
  139.         } else {
  140.                 $mthread['highlight'] = '';
  141.         }
  142.         $new_hot_threadlist[] = $mthread;
  143. }
  144. //热帖//

  145. //精华帖
  146. $hack_cut_str =29; //修改标题显示字数
  147. $hack_cut_strauthor = 9;
  148. $new_digest_threadlist = array();
  149. $dthread = array();
  150. $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE digest>'0' AND t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 14");
  151. while($dthread = $db->fetch_array($query)) {
  152.         $dthread['forumname'] = $dthread['name'];
  153.         $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
  154.         $dthread['view_author'] = cutstr($dthread['author'],$hack_cut_strauthor);
  155.         $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
  156.         $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
  157.         if($dthread['highlight']) {
  158.                 $string = sprintf('%02d', $dthread['highlight']);
  159.                 $stylestr = sprintf('%03b', $string[0]);

  160.                 $dthread['highlight'] = 'style="';
  161.                 $dthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  162.                 $dthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  163.                 $dthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  164.                 $dthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  165.                 $dthread['highlight'] .= '"';
  166.         } else {
  167.                 $dthread['highlight'] = '';
  168.         }
  169.         $new_digest_threadlist[] = $dthread;
  170. }
  171. //精华帖//
复制代码




2. 修改 index.htm


A. 新帖+新回复+热帖 调用

打开 index.htm查找

  1. <!--{loop $forumlist $key $forum}-->
  2.         <!--{if $forum['type'] == 'group' && $forumlist[($key + 1)]['type'] == 'forum'}-->
复制代码


在上面添加


  1. <div class="maintable">
  2. <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
  3.         <tr class="header">
  4.     <td class="header" width=34% align=center><b>≡最新话题≡</b></td>
  5.     <td class="header" width=33% align=center><b>≡最新回复≡</b></td>
  6.     <td class="header" width=33% align=center><b>≡热门话题≡</b></td>
  7.     </tr>
  8.         <tr>
  9.         <td class="altbg1">
  10.         <!--{loop $new_post_threadlist $nthread}-->
  11.         
  12. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT> <!--{if $nthread[replies]}--><a href="redirect.php?tid=$nthread[tid]&goto=newpost" $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]" target='_blank'>$nthread[view_subject]</a>
  13. <!--{else}-->
  14. <a href="redirect.php?tid=$nthread[tid]&goto=newpost" $nthread['highlight'] title="最新话题 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间{lang time}: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}{lang replies}: 暂时没有回覆" target='_blank'>$nthread[view_subject]</a><!--{/if}-->
  15. </td><td> <a href="viewpro.php?username=$nthread[author]" target="_blank" class="smalltxt">$nthread[view_author]</a></td></tr></table>
  16. <!--{/loop}-->
  17. </td>      
  18. <td class="altbg1">
  19. <!--{loop $new_reply_threadlist $rthread}-->
  20. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT>
  21. <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]" target='_blank'>$rthread[view_subject]</a></td><td> <a href="viewpro.php?username=$rthread[lastposter]"  target="_blank" class="smalltxt">$rthread[view_lastposter]</a></td></tr></table>
  22. <!--{/loop}-->
  23. </td>
  24. <td class="altbg1">
  25. <!--{loop $new_hot_threadlist $mthread}-->
  26. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT>
  27. <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]" target='_blank'>$mthread[view_subject]</a></td><td> <a href="viewpro.php?username=$mthread[lastposter]"  target="_blank" class="smalltxt">$mthread[view_lastposter]</a></td></tr></table>
  28. <!--{/loop}-->
  29. </td></tr>
  30. </table><br>
  31. </div>
复制代码




B. 新帖+新回复+精华帖 调用

打开 index.htm

查找
  1. <!--{loop $forumlist $key $forum}-->
  2.         <!--{if $forum['type'] == 'group' && $forumlist[($key + 1)]['type'] == 'forum'}-->
复制代码


在上面添加


  1. <div class="maintable">
  2. <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
  3.         <tr class="header">
  4.     <td class="header" width=34% align=center><b>≡最新话题≡</b></td>
  5.     <td class="header" width=33% align=center><b>≡最新回复≡</b></td>
  6.     <td class="header" width=33% align=center><b>≡精华文章≡</b></td>
  7.     </tr>
  8.         <tr>
  9.         <td rowspan="2" class="altbg1">
  10.         <!--{loop $new_post_threadlist $nthread}-->
  11.        
  12. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT> <!--{if $nthread[replies]}--><a href="redirect.php?tid=$nthread[tid]&goto=newpost" $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]" target='_blank'>$nthread[view_subject]</a>
  13. <!--{else}-->
  14. <a href="redirect.php?tid=$nthread[tid]&goto=newpost" $nthread['highlight'] title="最新话题 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间{lang time}: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}{lang replies}: 暂时没有回覆" target='_blank'>$nthread[view_subject]</a><!--{/if}-->
  15. </td><td> <a href="viewpro.php?username=$nthread[author]" target="_blank" class="smalltxt">$nthread[view_author]</a></td></tr></table>
  16. <!--{/loop}-->
  17. </td>      
  18. <td rowspan="2" class="altbg1">
  19. <!--{loop $new_reply_threadlist $rthread}-->
  20. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT>
  21. <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]" target='_blank'>$rthread[view_subject]</a></td><td> <a href="viewpro.php?username=$rthread[lastposter]"  target="_blank" class="smalltxt">$rthread[view_lastposter]</a></td></tr></table>
  22. <!--{/loop}-->
  23. </td>
  24. <td rowspan="2" class="altbg1">
  25. <!--{loop $new_digest_threadlist $dthread}-->
  26. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT face=Wingdings>z</FONT>
  27. <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]" target='_blank'>$dthread[view_subject]</a></td><td> <a href="viewpro.php?username=$dthread[lastposter]"  target="_blank" class="smalltxt">$dthread[view_author]</a></td></tr></table>
  28. <!--{/loop}-->
  29. </td></tr>

  30. </table><br>
  31. </div>
复制代码



修改完毕.

[ 本帖最后由 whitegerry 于 2006-6-11 08:43 编辑 ]

评分

1

查看全部评分

binundead 发表于 2006-3-11 21:55:17 | 显示全部楼层
不错
顶一个
回复

使用道具 举报

紫云杉 发表于 2006-3-11 21:58:08 | 显示全部楼层
我就用的这个
不过是4.0的^_^
回复

使用道具 举报

bbbbbb111111 发表于 2006-3-11 22:09:37 | 显示全部楼层
呵呵~~可以哦~~
回复

使用道具 举报

离恨天 发表于 2006-3-11 23:29:42 | 显示全部楼层
不错,虽然还不知道如何隐藏加密论坛的新帖,但还是要顶。
回复

使用道具 举报

81jun 发表于 2006-3-11 23:44:39 | 显示全部楼层
我也顶一下!
回复

使用道具 举报

jinghe1975 发表于 2006-3-12 00:08:04 | 显示全部楼层
感谢楼主,不知道影响不影响网页打开速度?用了说下!谢谢
回复

使用道具 举报

alantam 发表于 2006-3-12 00:47:35 | 显示全部楼层
不知如何調用會員發貼排行!!??
回复

使用道具 举报

aaaad 发表于 2006-3-12 02:06:57 | 显示全部楼层
希望有四行调用,其中把会员发贴排行在第一列就好了!
回复

使用道具 举报

aiqingmugua 发表于 2006-3-12 02:43:08 | 显示全部楼层
为什么我修改了,论坛什么反应都没啊?www.minitao.com/bbs
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 11:21 , Processed in 0.136067 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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