先发个效果网站 http://www.c88.in
我看到好动朋友在找,我一开始也百度过几个都不管用,今天为大家发布个行的
收费一个金币哈 我是穷怕的
(懒人包)是时候官方论坛模板的 如果是自己的模板那么还是要手动修改的
一、打开 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; }
复制代码 |