Discuz教程网

[代码修改] 【DiscuzX1.5】仿6.1经典横排,调用多条数据版 ,默认隐藏开关控制显示!

[复制链接]
authicon dly 发表于 2010-10-17 16:27:43 | 显示全部楼层 |阅读模式
资源名称:在logo旁边加图片的美化代码
适用版本:DiscuzX1.5(其他版本同理可改)
语言编码:GBK简体
插件作者:原作者失踪了(由 沉默的羔羊 帮助升级)
原帖地址:http://www.discuz.net/thread-1914809-1-2.html
资源简介:
横排美化,调用多条版块数据,默认隐藏开关控制显示!
友情提示:文件修改需谨慎,最好做到要备份!

更新懒人包,下载附件上传覆盖就可以了!GBK版本  UTF-8版本请勿直接覆盖,请先转码!手动修改办法请参见附件包里的说明文件!
懒人包包括以下扩展修改的 第一条和第二条!第三条可自行修改!不需要的也可以根据修改方法反修改去掉就可以了!


一、打开 forum.php 查找
  1. $navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);
复制代码
在下面添加
  1. $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  2. $hack_cut_str =60; // 这里修改标题长度
  3. $fids = array();
  4. if (file_exists("./data/cache/cache_forums.php")){
  5. require_once "./data/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 ".DB::table('forum_forum')." WHERE type='forum' OR type='sub'");
  15. while ($row = DB::fetch($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 ".DB::table('forum_thread')." t LEFT JOIN ".DB::table('forum_forum')." f ON f.fid = t.fid WHERE t.fid='$k' AND t.closed NOT LIKE 'moved|%' AND t.displayorder>=0 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($query)){
  28. $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
  29.         $row['date']= gmdate('m-d/H:i', $row['dateline'] + $_G['setting']['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. //每版最新主题--结束
复制代码



上一篇:【DiscuzX1.5】在logo旁边加图片的美化代码
下一篇:【DiscuzX1.5】个人信息下显示相关内容
authicon  楼主| dly 发表于 2010-10-17 16:44:06 | 显示全部楼层
打开 template/default/forum/discuz.htm 查找
  1. <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
  2.                                                                 </tr>
  3.                                                                 <!--{if $forum['orderid'] < $cat['forumscount']}-->
  4.                                                                         <tr class="fl_row">
  5.                                                                 <!--{/if}-->
  6.                                                         <!--{/if}-->
  7.                                                         <td class="fl_g" width="$cat[forumcolwidth]">
  8.                                                                 <div class="fl_icn_g"{if !empty($forum[extra][iconwidth]) && !empty($forum[icon])} style="width: {$forum[extra][iconwidth]}px;"{/if}>
  9.                                                                 <!--{if $forum[icon]}-->
  10.                                                                         $forum[icon]
  11.                                                                 <!--{else}-->
  12.                                                                         <a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}><img src="{IMGDIR}/forum{if $forum[folder]}_new{/if}.gif" alt="$forum[name]" /></a>
  13.                                                                 <!--{/if}-->
  14.                                                                 </div>
  15.                                                                 <dl{if !empty($forum[extra][iconwidth]) && !empty($forum[icon])} style="margin-left: {$forum[extra][iconwidth]}px;"{/if}>
  16.                                                                         <dt><a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}{if $forum[extra][namecolor]} style="color: {$forum[extra][namecolor]};"{/if}>$forum[name]</a><!--{if $forum[todayposts] && !$forum['redirect']}--><em class="xw0 xi1" title="{lang forum_todayposts}"> ($forum[todayposts])</em><!--{/if}--></dt>
  17.                                                                         <!--{if empty($forum[redirect])}--><dd><em>{lang forum_threads}: $forum[threads]</em>, <em>{lang forum_posts}: $forum[posts]</em></dd><!--{/if}-->
  18.                                                                         <dd>
  19.                                                                         <!--{if $forum['permission'] == 1}-->
  20.                                                                                 {lang private_forum}
  21.                                                                         <!--{else}-->
  22.                                                                                 <!--{if $forum['redirect']}-->
  23.                                                                                         <a href="$forumurl" class="xi2">{lang url_link}</a>
  24.                                                                                 <!--{elseif is_array($forum['lastpost'])}-->
  25.                                                                                         <!--{if $cat['forumcolumns'] < 3}-->
  26.                                                                                                 <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost" class="xi2"><!--{echo cutstr($forum[lastpost][subject], 30)}--></a> <cite>$forum[lastpost][dateline] <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}--></cite>
  27.                                                                                         <!--{else}-->
  28.                                                                                                 <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{lang forum_lastpost}: $forum[lastpost][dateline]</a>
  29.                                                                                         <!--{/if}-->
  30.                                                                                 <!--{else}-->
  31.                                                                                         {lang never}
  32.                                                                                 <!--{/if}-->
  33.                                                                         <!--{/if}-->
  34.                                                                         </dd>
  35.                                                                 </dl>
  36.                                                         </td>
复制代码

authicon  楼主| dly 发表于 2010-10-17 16:45:43 | 显示全部楼层
替换成
  1. <!--开始 -->
  2.                                 <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
  3.                                                                 </tr>
  4.                                                                 <!--{if $forum['orderid'] < $cat['forumscount']}-->
  5.                                                                         <tr class="fl_row">
  6.                                                                 <!--{/if}-->
  7.                                                         <!--{/if}-->
  8.                                                         <td class="fl_g" width="$cat[forumcolwidth]" style="padding:10px; ">
  9.                             <div class="b-top w100">      
  10.                                                         <div class="b-name">
  11.                                                                 <h2 class="margin"><a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}{if $forum[extra][namecolor]} style="color: {$forum[extra][namecolor]};"{/if}>$forum[name]</a></h2>
  12.                                                         </div>
  13.                                                         <div class="ctrl"  style="float:right;">
  14.                                                                 <a href="$forumurl&filter=author&orderby=dateline" title="依发布时间排序主题 [进入本版]"><img src="images/dateline_url.gif"></a>
  15.                                                                 <img src="images/master.gif" class="hand" onclick="toggle_collapse('lastpost_$forum[fid]');" title="最后发表.版主 [收/展]" />
  16.                                                                 <img src="images/dateline.gif" class="hand" onclick="toggle_collapse('dateline_$forum[fid]');" title="本版最新话题 [展/收]" />
  17.                                                                 <span style="today-post">
  18.                                                                 <!--{if $forum[todayposts] && !$forum['redirect']}--><em class="p-yes" title="今日帖数:$forum[todayposts]">$forum[todayposts]</em>&lt;!--{else}--><em class="p-no" title="今日帖数:0">0</em><!--{/if}-->
  19.                                                                 </span>
  20.                                                         </div>
  21.                                                 </div>

  22.                                                 <div class="clear w100">
  23.                                                         <div class="b-icon">$forum[icon]</div><div class="b-des">$forum[description]<!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}--></div>
  24.                                                 </div>

  25.                                                 <div class="clear b-thread" style="background: url(images/listbg_li.gif) no-repeat;">
  26.                                                 <ul  id="dateline_$forum[fid]" style="display:none;" class="list">
  27.                                                         <!--{loop ${"new_no".$forum[fid]."_threadlist"} $row}-->
  28.                                                                 <div class="t_no-pms">
  29.                                                                 <!--{if $forum['permission'] == 1}-->
  30.                                                                 {lang private_forum}, 您目前没有权限可查阅主题及内容
  31.                                                                 <!--{else}-->
  32.                                                                 <small class="t_date">$row['date']</small><a href="forum.php?mod=viewthread&tid=$row[tid]" $row[highlight] title="$row[subject] ($row['date'])" target='_self'>$row[view_subject]</a>
  33.                                                                 <!--{/if}-->
  34.                                                                 </div>
  35.                                                         <!--{/loop}-->
  36.                                                 </ul>
  37.                                                 </div>
  38.                                                 
  39.                                                 <div id="lastpost_$forum[fid]">
  40.                                                 <div class="clear t-lastpost w100">
  41.                                                         <!--{if $forum['permission'] == 1}-->
  42.                                                                         {lang forum_lastpost}: {lang private_forum}
  43.                                                                 <!--{else}-->
  44.                                                                         <!--{if $forum['redirect']}-->
  45.                                                                                 {lang forum_lastpost}: <a href="$forumurl" class="xi2">{lang url_link}</a>
  46.                                                                         <!--{elseif is_array($forum['lastpost'])}-->
  47.                                                                                 {lang forum_lastpost}: <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost" class="xi2"><!--{echo cutstr($forum[lastpost][subject], 25)}--></a> <cite><!--{if $forum['lastpost']['author']}-->(by $forum['lastpost']['author'])<!--{else}-->{lang anonymous}<!--{/if}--></cite>
  48.                                                                         <!--{else}-->
  49.                                                                                 {lang forum_lastpost}: {lang never}
  50.                                                                         <!--{/if}-->
  51.                                                                 <!--{/if}-->
  52.                                                 </div>
  53.                                                 <div style="clear mod w100">
  54.                                                         <!--{if $forum['moderators']}-->{lang forum_moderators}: <span class="xi2">$forum[moderators]</span> | <!--{/if}-->
  55.                                                           {lang forum_threads}:$forum[threads]  {lang forum_posts}:$forum[posts]
  56.                                                 </div>
  57.                                                 </div>
  58.                                  </td>
  59.                          <!--结束 -->
复制代码

打开 template/default/common/header.htm
在</head> 上添加
  1. <script language="JavaScript">
  2. <!-- Hide
  3.         function killErrors() {
  4.                 return true;
  5.         }
  6. window.onerror = killErrors;
  7. // -->
  8. </script>
复制代码

打开 template/default/common/common.css
在最后面添加
  1. /*横排美化*/

  2. /*~~~~~~~~~~~ EXTRA   Common~~~~~~~~~~~~~*/

  3. .hand { cursor:hand; cursor: pointer; }
  4. .clear { clear:both; }
  5. .w100 { width:100%; }
  6. /*~~~~~~~~~~~ EXTRA  Index Forumlist~~~~~~~~~~~~~*/

  7. .forumlist th.board { vertical-align: top; background-image: none; padding:10px !important; }
  8.         div.b-top {  display:block; width:100%; overflow: hidden; }
  9.                 div.b-name { float:left; height: 20px; width:60%; overflow:hidden; }
  10.                         div.b-name h2.margin { margin:0 0 3px 0;  }
  11.                 div.crtl { float:right; text-align:right;  }
  12.                         div.ctrl img { vertical-align:middle; margin:1px 0;  }
  13.                         span.today-post em, span.today-post em b { font-family: Verdana, Arial, Helvetica, sans-serif; }
  14.                                 em.p-yes { padding:0 5px; border:1px solid #F06; background:#FFFFE1; color:#F06; font-size:11px; font-weight:bold; }
  15.                                 em.p-no { padding:0 5px; border:1px solid #CCC;  font-size:11px; }
  16.                 div.b-icon { float:left; }
  17.                 div.b-des { color:{LIGHTTEXT}; overflow:hidden; }
  18.         div.b-thread { margin-top:5px; padding:1px 0; background-image: url(images/listbg_li.gif) no-repeat; width:100%; }
  19.                 div.b-thread ul.list { padding:0 2px 0 10px; list-style-type: none; line-height: 20px; }
  20.                         div.b-thread ul.list .t_no-pms { overflow: hidden; height:20px; width:100% }
  21.                         div.b-thread ul.list .t_date { float:right; color:{LIGHTTEXT}; margin: 0 0 0 5px }
  22.         div.t-lastpost { color:{LIGHTTEXT}; margin-top:5px;overflow: hidden; height:1.3em;  }
  23.         div.mod { color:{LIGHTTEXT}; overflow: hidden; height:1.5em;  }
复制代码


authicon  楼主| dly 发表于 2010-10-17 16:52:59 | 显示全部楼层
以下是扩展修改,修改基于以上修改完之后(非必要,按个人喜好)

一、版块底部版块信息美化
在discuz.htm中查找
  1. <!--{if
  2. $forum['moderators']}-->{lang forum_moderators}: <span
  3. class="xi2">$forum[moderators]</span> | <!--{/if}-->
  4. {lang forum_threads}:$forum[threads] {lang forum_posts}:$forum[posts]
复制代码
替换成
  1. <dt>Today:
  2. <font color="#FF3399">$forum[todayposts]</font> Post:
  3. <font color="#00CCFF">$forum[threads]</font> Reply: <font
  4. color="#99CC00">$forum[posts]</font></dt>
复制代码
二、鼠标经过图标显示版主列表
在discuz.htm中查找
  1. <div class="b-icon">$forum[icon]</div>
复制代码
替换成
  1. <div
  2. class="b-icon"><span onmouseout="this.className='popmenuclose';"
  3. class="popmenuclose">$forum[icon]<div>版主:<!--{if
  4. $forum['moderators']}-->$forum[moderators]<!--{else}-->暂时无版
  5. 主<!--{/if}--></div></span></div>
复制代码
在template/default/common/common.css的最后添加
  1. .popmenuclose div{display:none}
  2. .popmenuopen{position:relative;z-index:9999;}
  3. .popmenuopen div{border:3px solid #E1E1D0;background:#FFF;position:absolute;padding:4px;overflow:hidden; width:100px;}
  4. .popmenuopen
  5. div a{padding:2px 5px 2px 18px;
  6. display:block;background:url(/images/ggao.gif) no-repeat 0 -16px}.laba
  7. {margin:0 auto; background:#FFFFFF; border:1px solid #EDECED;
  8. padding:2px 5px 4px; color:#555; border-top:0;
  9. border-bottom:0;line-height:19px}
复制代码
里面的列表背景图片路径可以根据自己站的情况自定义,包括显示层的背景颜色等等!
去掉版主列表之间的 逗号 请见
https://www.discuz.1314study.com/forum-redirect-goto-findpost-ptid-324-pid-473-fromuid-1.html
三、默认展开列表修改方法
打开 discuz.htm 查找
  1. <ul id="dateline_$forum[fid]" style="display:none;" class="list">
复制代码
替换成
  1. <ul id="dateline_$forum[fid]" class="list">
复制代码
最后上传附件图片包 更新缓存!
PS.建议横排数为3个,多了少了都不怎么好看!不过可以根据自己喜好来修改!

附件下载:
游客,如果您要查看本帖隐藏内容请回复








authicon  楼主| dly 发表于 2010-10-17 17:01:17 | 显示全部楼层
打开 source/function/function_forumlist.php 查找
  1. $modlist .= $comma.'<a class="notabs" href="home.php?mod=space&username='.rawurlencode($moderator).'" c="1">'.($inherit ? '<strong>'.$moderator.'</strong>' : $moderator).'</a>';
复制代码
找到这条代码下面的
  1. $comma = ', ';
复制代码
修改成
  1. $comma = '';
复制代码
这样就可以了!
authicon summmer 发表于 2011-5-7 04:59:47 | 显示全部楼层
好辛苦才找到啊
authicon icenna 发表于 2011-5-9 04:00:03 | 显示全部楼层
谢谢,学习了
authicon qqoxygen 发表于 2011-5-14 12:59:46 | 显示全部楼层
偶的天啊!爱死你了
authicon 风中徜徉 发表于 2011-5-16 05:59:59 | 显示全部楼层
好东西要顶的。
authicon summmer 发表于 2011-5-16 21:59:45 | 显示全部楼层
好东东下下来看看
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2024-5-16 20:34

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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