|
乐站SEO论坛分享前言:
号称是X2.5插件中对论坛版块进行美化的最好插件,小编也在本地进行了测试,安装后论坛首页仿佛变成了一个程序下载站,这让使用DZ多年的我产生眼前一亮的感觉,更难能可贵的是通过简单修改文件可做到自由开关是否显示调用版块内的贴子标题。因此设置了版块横向显示,而又苦恼于不显示论坛简介的站长朋友们,这款插件真的适合您。
附件包里包含已修改文件,可直接将upload文件夹下的文件覆盖到论坛根目录下
PS:如果曾修改过forum.php、discuz.htm等文件,建议按照下列步骤自行操作。
一、打开 forum.php 查找- $navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);
复制代码 ===============================================================
在其下面添加
===============================================================
- $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
- $hack_cut_str =60; // 这里修改标题长度
- $fids = array();
- if (file_exists("./data/cache/cache_forums.php")){
- require_once "./data/cache/cache_forums.php";
- if (is_array($_DCACHE['forums'])){
- foreach ($_DCACHE['forums'] as $k => $v){
- if (!strstr(',sub,forum,',','.$v['type'].',')) continue;
- $fids[$k] = 5; // 这里是第一处调用条数需要和后面的设置一样。
- }
- }
- }
- if (count($fids) < 1){
- $query = DB::query("SELECT fid FROM ".DB::table('forum_forum')." WHERE type='forum' OR type='sub'");
- while ($row = DB::fetch($query)){
- $fids[$row['fid']] = 5; // 这里是第二处调用条数需要和前面的设置一样。
- }
- }
- $limit_counts = 0;
- foreach ($fids as $k => $v){
- $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 ";
- }
- if ($sql){
- $sql = substr($sql,0,strlen($sql)-6);
- }
- $query = DB::query($sql);
- while ($row = DB::fetch($query)){
- $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
- $row['date']= gmdate('m-d/H:i', $row['dateline'] + $_G['setting']['timeoffset'] * 3600);
- if($row['highlight']) {
- $string = sprintf('%02d', $row['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $row['highlight'] = 'style="';
- $row['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $row['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $row['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $row['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $row['highlight'] .= '"';
- } else {
- $row['highlight'] = '';
- }
- ${'new_no'.$row['fid'].'_threadlist'}[] = $row;
- }
- //每版最新主题--结束
复制代码
===============================================================
打开 template/default/forum/discuz.htm 查找
===============================================================
- <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
- </tr>
- <!--{if $forum['orderid'] < $cat['forumscount']}-->
- <tr class="fl_row">
- <!--{/if}-->
- <!--{/if}-->
- <td class="fl_g" width="$cat[forumcolwidth]">
- <div class="fl_icn_g"{if !empty($forum[extra][iconwidth]) && !empty($forum[icon])} style="width: {$forum[extra][iconwidth]}px;"{/if}>
- <!--{if $forum[icon]}-->
- $forum[icon]
- <!--{else}-->
- <a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}><img src="{IMGDIR}/forum{if $forum[folder]}_new{/if}.gif" alt="$forum[name]" /></a>
- <!--{/if}-->
- </div>
- <dl{if !empty($forum[extra][iconwidth]) && !empty($forum[icon])} style="margin-left: {$forum[extra][iconwidth]}px;"{/if}>
- <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>
- <!--{if empty($forum[redirect])}--><dd><em>{lang forum_threads}: $forum[threads]</em>, <em>{lang forum_posts}: $forum[posts]</em></dd><!--{/if}-->
- <dd>
- <!--{if $forum['permission'] == 1}-->
- {lang private_forum}
- <!--{else}-->
- <!--{if $forum['redirect']}-->
- <a href="$forumurl" class="xi2">{lang url_link}</a>
- <!--{elseif is_array($forum['lastpost'])}-->
- <!--{if $cat['forumcolumns'] < 3}-->
- <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>
- <!--{else}-->
- <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{lang forum_lastpost}: $forum[lastpost][dateline]</a>
- <!--{/if}-->
- <!--{else}-->
- {lang never}
- <!--{/if}-->
- <!--{/if}-->
- </dd>
- </dl>
- </td>
复制代码
===============================================================
替换成
===============================================================
- <!--开始 -->
- <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
- </tr>
- <!--{if $forum['orderid'] < $cat['forumscount']}-->
- <tr class="fl_row">
- <!--{/if}-->
- <!--{/if}-->
- <td class="fl_g" width="$cat[forumcolwidth]" style="padding:10px; ">
- <div class="b-top w100">
- <div class="b-name">
- <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>
- </div>
- <div class="ctrl" style="float:right;">
- <a href="$forumurl&filter=author&orderby=dateline" title="依发布时间排序主题 [进入本版]"><img src="images/dateline_url.gif"></a>
- <img src="images/master.gif" class="hand" onclick="toggle_collapse('lastpost_$forum[fid]');" title="最后发表.版主 [收/展]" />
- <img src="images/dateline.gif" class="hand" onclick="toggle_collapse('dateline_$forum[fid]');" title="本版最新话题 [展/收]" />
- <span style="today-post">
- <!--{if $forum[todayposts] && !$forum['redirect']}--><em class="p-yes" title="今日帖数:$forum[todayposts]">$forum[todayposts]</em><!--{else}--><em class="p-no" title="今日帖数:0">0</em><!--{/if}-->
- </span>
- </div>
- </div>
- <div class="clear w100">
- <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>
- </div>
- <div class="clear b-thread" style="background: url(images/listbg_li.gif) no-repeat;">
- <ul id="dateline_$forum[fid]" style="display:none;" class="list">
- <!--{loop ${"new_no".$forum[fid]."_threadlist"} $row}-->
- <div class="t_no-pms">
- <!--{if $forum['permission'] == 1}-->
- {lang private_forum}, 您目前没有权限可查阅主题及内容
- <!--{else}-->
- <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>
- <!--{/if}-->
- </div>
- <!--{/loop}-->
- </ul>
- </div>
-
- <div id="lastpost_$forum[fid]">
- <div class="clear t-lastpost w100">
- <!--{if $forum['permission'] == 1}-->
- {lang forum_lastpost}: {lang private_forum}
- <!--{else}-->
- <!--{if $forum['redirect']}-->
- {lang forum_lastpost}: <a href="$forumurl" class="xi2">{lang url_link}</a>
- <!--{elseif is_array($forum['lastpost'])}-->
- {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>
- <!--{else}-->
- {lang forum_lastpost}: {lang never}
- <!--{/if}-->
- <!--{/if}-->
- </div>
- <div style="clear mod w100">
- <!--{if $forum['moderators']}-->{lang forum_moderators}: <span class="xi2">$forum[moderators]</span> | <!--{/if}-->
- {lang forum_threads}:$forum[threads] {lang forum_posts}:$forum[posts]
- </div>
- </div>
- </td>
- <!--结束 -->
复制代码
===============================================================
打开 template/default/common/header.htm
在</head> 上添加
===============================================================
- <script language="JavaScript">
- <!-- Hide
- function killErrors() {
- return true;
- }
- window.onerror = killErrors;
- // -->
- </script>
复制代码
==============================================================
打开 template/default/common/common.css
在最后面添加
==============================================================
- /*横排美化*/
- /*~~~~~~~~~~~ EXTRA Common~~~~~~~~~~~~~*/
- .hand { cursor:hand; cursor: pointer; }
- .clear { clear:both; }
- .w100 { width:100%; }
- /*~~~~~~~~~~~ EXTRA Index Forumlist~~~~~~~~~~~~~*/
- .forumlist th.board { vertical-align: top; background-image: none; padding:10px !important; }
- div.b-top { display:block; width:100%; overflow: hidden; }
- div.b-name { float:left; height: 20px; width:60%; overflow:hidden; }
- div.b-name h2.margin { margin:0 0 3px 0; }
- div.crtl { float:right; text-align:right; }
- div.ctrl img { vertical-align:middle; margin:1px 0; }
- span.today-post em, span.today-post em b { font-family: Verdana, Arial, Helvetica, sans-serif; }
- em.p-yes { padding:0 5px; border:1px solid #F06; background:#FFFFE1; color:#F06; font-size:11px; font-weight:bold; }
- em.p-no { padding:0 5px; border:1px solid #CCC; font-size:11px; }
- div.b-icon { float:left; }
- div.b-des { color:{LIGHTTEXT}; overflow:hidden; }
- div.b-thread { margin-top:5px; padding:1px 0; background-image: url(images/listbg_li.gif) no-repeat; width:100%; }
- div.b-thread ul.list { padding:0 2px 0 10px; list-style-type: none; line-height: 20px; }
- div.b-thread ul.list .t_no-pms { overflow: hidden; height:20px; width:100% }
- div.b-thread ul.list .t_date { float:right; color:{LIGHTTEXT}; margin: 0 0 0 5px }
- div.t-lastpost { color:{LIGHTTEXT}; margin-top:5px;overflow: hidden; height:1.3em; }
- div.mod { color:{LIGHTTEXT}; overflow: hidden; height:1.5em; }
复制代码
==============================================================
以下是扩展修改,修改基于以上修改完之后(非必要,按个人喜好)
一、版块底部版块信息美化
在discuz.htm中查找
==============================================================
- <!--{if $forum['moderators']}-->{lang forum_moderators}: <span class="xi2">$forum[moderators]</span> | <!--{/if}-->
- {lang forum_threads}:$forum[threads] {lang forum_posts}:$forum[posts]
复制代码
==============================================================
替换成
==============================================================
- <dt>Today: <font color="#FF3399">$forum[todayposts]</font> Post: <font color="#00CCFF">$forum[threads]</font> Reply: <font color="#99CC00">$forum[posts]</font></dt>
复制代码
===============================================================
二、鼠标经过图标显示版主列表
在discuz.htm中查找
===============================================================
- <div class="b-icon">$forum[icon]</div>
复制代码 ==============================================================
替换成
==============================================================
- <div class="b-icon"><span onmouseover="this.className='popmenuopen';" onmouseout="this.className='popmenuclose';" class="popmenuclose">$forum[icon]<div>版主:<!--{if $forum['moderators']}-->$forum[moderators]<!--{else}-->暂时无版主<!--{/if}--></div></span></div>
复制代码
===============================================================
在template/default/common/common.css的最后添加
===============================================================
- .popmenuclose div{display:none}
- .popmenuopen{position:relative;z-index:9999;}
- .popmenuopen div{border:3px solid #E1E1D0;background:#FFF;position:absolute;padding:4px;overflow:hidden; width:100px;}
- .popmenuopen div a{padding:2px 5px 2px 18px; display:block;background:url(/images/ggao.gif) no-repeat 0 -16px}.laba {margin:0 auto; background:#FFFFFF; border:1px solid #EDECED; padding:2px 5px 4px; color:#555; border-top:0; border-bottom:0;line-height:19px}
复制代码
===============================================================
三、默认展开列表修改方法
打开 discuz.htm 查找
===============================================================
- <ul id="dateline_$forum[fid]" style="display:none;" class="list">
复制代码
===============================================================
替换成
===============================================================
- <ul id="dateline_$forum[fid]" class="list">
复制代码
最后上传附件图片包 更新缓存!
|
|