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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 首页三格帖子调用+美化+作者for DZ5.0RC

[复制链接]
wgding 发表于 2006-8-8 21:06:06 | 显示全部楼层 |阅读模式
适用版本:  discuz!5.0C
修改难度:  易
数据库升级:  无
图片演示:

站点演示:
http://www.i79.cn
此插件会增加2个查询,看自己喜欢与否吧

1.打开根目录下的  discuz.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, 13");
  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, 13");
  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.views DESC LIMIT 0, 13");
  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. //热帖//
复制代码


2.打开/templates/default/discuz.htm

查找

  1. <!--{if !empty($advlist['text'])}-->
  2.         <div class="maintable">
  3.         <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">$advlist[text]</table>
  4.         <br></div>
  5. <!--{/if}-->
复制代码


在上面添加

  1. <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
  2.         <tr class="header">
  3.     <td class="header" width=34% align=center><b>≡最新话题≡</b></td>
  4.     <td class="header" width=33% align=center><b>≡最新回复≡</b></td>
  5.     <td class="header" width=33% align=center><b>≡热门话题≡</b></td>
  6.     </tr>
  7.         <tr>
  8.         <td class="altbg1">
  9.         <!--{loop $new_post_threadlist $nthread}-->
  10.         
  11. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT color=#FFA6D2 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>
  12. <!--{else}-->
  13. <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}-->
  14. </td><td> <a href="viewpro.php?username=$nthread[author]" target="_blank" class="smalltxt">$nthread[view_author]</a></td></tr></table>
  15. <!--{/loop}-->
  16. </td>      
  17. <td class="altbg1">
  18. <!--{loop $new_reply_threadlist $rthread}-->
  19. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT color=#FFA6D2 face=Wingdings>z</FONT>
  20. <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>
  21. <!--{/loop}-->
  22. </td>
  23. <td class="altbg1">
  24. <!--{loop $new_hot_threadlist $mthread}-->
  25. <table border=0 width='100%' cellspacing=2><tr><td height=12 width='78%'><FONT color=#FFA6D2 face=Wingdings>z</FONT>
  26. <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=$rthread[lastposter]"  target="_blank" class="smalltxt">$mthread[view_lastposter]</a></td></tr></table>
  27. <!--{/loop}-->
  28. </td></tr>
  29. </table><br>
复制代码



如果要修改调用的显示条数,则修改以下代码位置(有3处要修改)
$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, 13");

把13改为你想显示的条数就可以。
开心一生 发表于 2006-8-8 21:12:58 | 显示全部楼层
:)非常支持
回复

使用道具 举报

凱子 发表于 2006-8-8 21:16:07 | 显示全部楼层
地板```````

很不错```但是我不需要``
回复

使用道具 举报

tianye1990 发表于 2006-8-8 21:21:16 | 显示全部楼层
ding le
回复

使用道具 举报

mannoo 发表于 2006-8-10 17:01:58 | 显示全部楼层
谢谢楼主!
我安完了以后,周围会多出来一个边,(是背景色),怎么回事?您帮忙给看看,改哪合适?
http://www.mannoo.com
回复

使用道具 举报

hbpin 发表于 2006-8-12 17:26:24 | 显示全部楼层
能搞个不要最新热门,搞个精华不?
回复

使用道具 举报

dingboys 发表于 2006-8-12 18:55:20 | 显示全部楼层
你好,请问一下,我修改之后但仍无法看到三列表格!
http://www.dyxyuan.com.cn
在线等待,望回复.
回复

使用道具 举报

joewen 发表于 2006-8-14 20:15:20 | 显示全部楼层
显示的行数是哪个参数控制的?谢谢!
回复

使用道具 举报

HY清风 发表于 2006-8-15 00:17:49 | 显示全部楼层
HY清风 收录提示
我很赞同,收录到 Discuz! 5.0『插件.风格.美化.功能』HY清风 收集整理贴!
https://discuz.dismall.com/thread-359738-1-1.html
感谢你发布或推荐优秀作品给本贴!
推荐方式A、回复此贴  B、论坛短消息 PM 我!点这里PM我
回复

使用道具 举报

5872216 发表于 2006-8-15 07:37:20 | 显示全部楼层
支持!
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-2 02:41 , Processed in 0.105552 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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