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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[修改] DZ7.1首页横排美化【修正版,手动修改】

[复制链接]
远方的回忆 发表于 2009-11-2 11:14:37 | 显示全部楼层 |阅读模式
插件发布
插件名称: DZ7.1首页横排美化【修正版,手动修改】
插件来源:
适用版本: Discuz! 7.1
语言编码: GBK简体 
最后更新时间:
插件作者: 已经未知了
插件简介: 主要都来自论坛https://discuz.dismall.com/thread-1455778-1-4.html
不过按照这位朋友的文件覆盖在火狐下错位了(这是6.1版的时候就存在的BUG),并且今日贴量这部分也有错位现象(这部分内容直接跳到公告那里去了)。
于是结合之前使用6.1和7.0版,逐句对照三个版本的代码(论坛朋友、作者原版、我所用的7.0版)对这两个问题进行了解决,解决过程就不啰嗦了。
当然,我是在默认模板下修改的,由于大家的模板不同,有可能会导致我这修改也出现BUG,但我只是一个业余的,所有也无法时刻帮助大家,因此修改前再次提醒备份源文件。
本帖最后由 远方的回忆 于 2009-11-2 11:21 编辑

最终修改方法:
一、/include/index_classics.inc.php 修改

查找:
  1. $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码
下面添加:
  1. //帖子调用开始
  2. $hack_cut_str =60; // 这里修改标题长度
  3. $fids = array();
  4. if (file_exists("./forumdata/cache/cache_forums.php")){
  5.         require_once "./forumdata/cache/cache_forums.php";
  6.         if (is_array($_DCACHE['forums'])){
  7.                 foreach ($_DCACHE['forums'] as $k => $v){
  8.                         if (!strstr(',sub,forum,',','.$v['type'].',')) continue;
  9.                         $fids[$k] = 5; // 这里是第一处调用条数需要和后面的设置一样。
  10.                 }
  11.         }
  12. }
  13. if (count($fids) < 1){
  14.         $query = $db->query("SELECT fid FROM {$tablepre}forums WHERE type='forum' OR type='sub'");
  15.         while ($row = $db->fetch_array($query)){
  16.                 $fids[$row['fid']] = 5; // 这里是第二处调用条数需要和前面的设置一样。
  17.         }
  18. }
  19. $limit_counts = 0;

  20. foreach ($fids as $k => $v){
  21.         $sql .= "(SELECT t.*, f.name FROM {$tablepre}threads t LEFT JOIN {$tablepre}forums f ON f.fid = t.fid WHERE t.fid='$k' ORDER BY t.dateline DESC LIMIT $v) UNION ";
  22. }
  23. if ($sql){
  24.         $sql = substr($sql,0,strlen($sql)-6);
  25. }
  26. $query = $db->query($sql);
  27. while ($row = $db->fetch_array($query)){
  28.         $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
  29.         $row['date']= gmdate("$dateformat", $row['dateline'] + $timeoffset * 3600);
  30.         if($row['highlight']) {
  31.                         $string = sprintf('%02d', $row['highlight']);
  32.                         $stylestr = sprintf('%03b', $string[0]);
  33.                         $row['highlight'] = 'style="';
  34.                         $row['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  35.                         $row['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  36.                         $row['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  37.                         $row['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
  38.                         $row['highlight'] .= '"';
  39.         } else {
  40.                         $row['highlight'] = '';
  41.         }
  42.         ${'new_no'.$row['fid'].'_threadlist'}[] = $row;
  43. }
  44. //帖子调用结束
复制代码
二、templates/default/css_common.htm 修改

查找:
  1. .list th { background: url({IMGDIR}/forum.gif) 5px 10px no-repeat; padding-left: 45px !important; }
复制代码
替换为:
  1. .list th { background: url({IMGDIR}/forum.gif) 3px 17px no-repeat; padding-left: 15px !important; }
复制代码
三、templates/default/discuz.htm 修改

查找:
  1. <tbody id="forum$forum[fid]">  至  $cat['endrows']
复制代码
全部内容
替换为:
  1. <tbody id="forum$forum[fid]">
  2.                         <tr>
  3.                             <th$forum[folder]>
  4.                                 $forum[icon]
  5.                                 <div class="left">
  6.                                 <h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank" {/if}>$forum[name]</a> <font class="smalltext"><!--{if $forum[todayposts]}-->T: <font color="#FF3399">$forum[todayposts]</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->T: <font color="#FF3399">0</font><!--{/if}--> P: <font color="#00CCFF">$forum[threads]</font> R: <font color="#99CC00">$forum[posts]</font></font><!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><p>{lang forum_moderators}: $forum[moderators]</p><!--{else}--><span class="dropmenu" id="mod$forum[fid]" onmouseover="showMenu(this.id)">{lang forum_moderators}</span><ul class="moderators popupmenu_popup" id="mod$forum[fid]_menu" style="display: none">$forum[moderators]</ul><!--{/if}--><!--{/if}--></h2>
  7.                                 <!--{if $forum[description]}--><p>$forum[description]</p><!--{/if}-->
  8.                                 <!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}-->

  9.                                 </div>
  10.                             </td>
  11.                             <th class="forumlast"{$forum[folder]}>
  12.                                                             <!--{if $forum['permission'] == 1}-->
  13.                                 {lang private_forum}
  14.                             <!--{else}-->
  15.                                 <!--{if $forum['redirect']}-->
  16.                                     <a href="forumdisplay.php?fid=$forum[fid]">{lang url_link}</a>
  17.                                 <!--{elseif is_array($forum['lastpost'])}-->
  18.                                     <p> <a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{echo cutstr($forum[lastpost][subject], 26)}</a></p>
  19.                                     <cite><!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}--> - $forum[lastpost][dateline]</cite>
  20.                                 <!--{else}-->
  21.                                     {lang never}
  22.                                     <p>{lang never}</p>
  23.                                 <!--{/if}-->
  24.                             <!--{/if}-->
  25.                             </td>

  26.                             </td>
  27.                         </tr>
  28.                     </tbody>
  29.                 <!--{/loop}-->
  30.             <!--{else}-->
  31.                 <tr class="narrowlist">
  32.                 <!--{loop $cat['forums'] $forumid}-->
  33.                     <!--{eval $forum=$forumlist[$forumid];}-->
  34.                     <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
  35.                         </tr></tbody>
  36.                         <!--{if $forum['orderid'] < $cat['forumscount']}-->
  37.                             <tbody><tr>
  38.                         <!--{/if}-->
  39.                     <!--{/if}-->
  40.                     <td width="$cat[forumcolwidth]" style="vertical-align: top; background-image: none; padding:8px !important;">
  41.                         <div style="float:right; "><!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="images/moderator.gif" title="查看版主 [展/收]" onclick="toggle_collapse('dateline_$forum[fid]');" style="cursor:pointer" /> <em class="moderators" id="dateline_$forum[fid]" style="display:none">$forum[moderators]</em><!--{/if}--><!--{/if}--></div>
  42. $forum[icon]
  43.            <h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank"{/if}>$forum[name]</a></h2>
  44.                            <!--{if $forum[todayposts]}-->
  45.       <!--{else}-->
  46.    <!--{/if}--></div></div>

  47. <!--{if $forum[description]}--><div style="width:100%; ">$forum[description]</div><!--{/if}-->
  48.             <!--{if $forum['subforums']}--><div style="width:100%; ">{lang forum_subforums}: $forum['subforums']</div><!--{/if}-->
  49. <!--{if $forum[todayposts]}-->今日: <font color="#FF3399">$forum[todayposts]</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->今日: <font color="#FF3399">0</font><!--{/if}--> 主题: <font color="#00CCFF">$forum[threads]</font> 帖子: <font color="#99CC00">$forum[posts]</font></font>
  50.                                 <ul style="background-image: url(images/listbg_li.gif); padding:1px 2px 0px 10px; list-style-type: none; line-height: 20px; clear: both; margin:8px 0; ">
  51.                                 <!--{loop ${"new_no".$forum[fid]."_threadlist"} $row}-->
  52.    <div style="overflow: hidden; height:20px; width:100%"><small style="float:right; color:#9C8B88; margin: 0 0 0 5px">$row['date']</small><a href="viewthread.php?tid=$row[tid]" title="$row[subject]" target='_self'>$row[view_subject]</a></div>
  53.                                 <!--{/loop}-->
  54.                                 </ul>
  55.                     </td>
  56.                 <!--{/loop}-->
  57.                 $cat['endrows']
复制代码
(造成火狐错位和今日贴量错位的原因在以上这里的修改)

四、templates/default/forumdisplay_subforum.htm 修改

查找:
  1. <!--{if !$forum['forumcolumns']}-->  至  <!--{loop $sublist $sub}-->
复制代码
全部内容
替换为:
  1. <!--{if !$forum['forumcolumns']}-->
  2.         <!--{loop $sublist $sub}-->
  3.             <tbody>
  4.                 <tr>
  5.                     <td>
  6.                         $sub[icon]
  7.     <div class="left">
  8.     <h2><a href="forumdisplay.php?fid=$sub[fid]" {if $sub[redirect]}target="_blank"{/if}>$sub[name]</a> <font class="smalltext"><!--{if $sub[todayposts] && !$sub['redirect']}-->Today: <font color="#FF3399">$forum[todayposts]</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->Today: <font color="#FF3399">0</font><!--{/if}--> Post: <font color="#00CCFF">$forum[threads]</font> Reply: <font color="#99CC00">$forum[posts]</font></font> <!--{if $sub['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="{IMGDIR}/moderator.gif" title="论坛版主" onclick="toggle_collapse('coll_3');" style="cursor:pointer" /> <em class="moderators" id="coll_3" style="display:none">$forum[moderators]</em><!--{/if}--><!--{/if}--></h2>
  9.     <!--{if $sub[description]}--><p>版块介绍: $sub[description]</p><!--{/if}-->
  10.             <!--{if $sub['subforums']}--><p>{lang forum_subforums}: $sub['subforums']</p><!--{/if}-->
  11.     </div>
  12.                             </td>
  13.                     <th class="forumlast"{$forum[folder]}>
  14.                     <!--{if $sub['permission'] == 1}-->
  15.                         {lang private_forum}
  16.                     <!--{else}-->
  17.                         <!--{if $sub['redirect']}-->
  18.                             <a href="forumdisplay.php?fid=$sub[fid]">{lang url_link}</a>
  19.                         <!--{elseif is_array($sub['lastpost'])}-->
  20.                             <p>最新主题: <a href="redirect.php?tid=$sub[lastpost][tid]&goto=lastpost#lastpost">{echo cutstr($sub[lastpost][subject], 20)}</a></p>
  21.                             <cite><!--{if $sub['lastpost']['author']}-->作者相关: $sub['lastpost']['author']<!--{else}-->作者相关: {lang anonymous}<!--{/if}--> - $sub[lastpost][dateline]</cite>
  22.                         <!--{else}-->
  23.                             最新主题: {lang never}
  24.                                                                                                                 <p>作者相关: {lang never}</p>
  25.                         <!--{/if}-->
  26.                     <!--{/if}-->
  27.                     </td>
  28.                 </tr>
  29.             </tbody>
  30.         <!--{/loop}-->
  31.     <!--{else}-->
  32.         <tr class="narrowlist">
  33.         <!--{loop $sublist $sub}-->
复制代码
至于图片文件,就请到DZ这位朋友的帖下载吧。(人家修改的是收费附件,我也不至于这样断人家财路了...囧)

有朋友要演示,就请看这里吧:http://www.falcomcn.com/bbs/index.php
maikongjian14a 发表于 2009-11-2 11:15:39 | 显示全部楼层
收藏了哟 感谢
回复

使用道具 举报

chengjiabing 发表于 2009-11-2 11:15:43 | 显示全部楼层
支持下最后有演示。
回复

使用道具 举报

 楼主| 远方的回忆 发表于 2009-11-2 11:19:05 | 显示全部楼层
本帖最后由 远方的回忆 于 2009-11-2 11:24 编辑

3# chengjiabing


    演示已经附上
PS:最好是有版块图标的横排才好看。
回复

使用道具 举报

Imabird 发表于 2009-11-3 14:15:29 | 显示全部楼层
帮顶..........
回复

使用道具 举报

zyhoo 发表于 2009-11-3 14:42:20 | 显示全部楼层
顶起。。。。。。。。。。。。。。。。。。
回复

使用道具 举报

gz2010 发表于 2009-11-4 21:40:09 | 显示全部楼层
谢谢
回复

使用道具 举报

xzhm1314 发表于 2009-11-4 21:44:41 | 显示全部楼层
顶顶顶顶顶顶顶顶顶
回复

使用道具 举报

xjxym 发表于 2009-11-8 10:11:11 | 显示全部楼层
赞个.........................................
回复

使用道具 举报

10#
无效楼层,该帖已经被删除
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-6-18 18:34 , Processed in 0.114616 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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