本帖最后由 远方的回忆 于 2009-11-2 11:21 编辑
最终修改方法:
一、/include/index_classics.inc.php 修改
查找:- $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码 下面添加:- //帖子调用开始
- $hack_cut_str =60; // 这里修改标题长度
- $fids = array();
- if (file_exists("./forumdata/cache/cache_forums.php")){
- require_once "./forumdata/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 {$tablepre}forums WHERE type='forum' OR type='sub'");
- while ($row = $db->fetch_array($query)){
- $fids[$row['fid']] = 5; // 这里是第二处调用条数需要和前面的设置一样。
- }
- }
- $limit_counts = 0;
- foreach ($fids as $k => $v){
- $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 ";
- }
- if ($sql){
- $sql = substr($sql,0,strlen($sql)-6);
- }
- $query = $db->query($sql);
- while ($row = $db->fetch_array($query)){
- $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
- $row['date']= gmdate("$dateformat", $row['dateline'] + $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;
- }
- //帖子调用结束
复制代码 二、templates/default/css_common.htm 修改
查找:- .list th { background: url({IMGDIR}/forum.gif) 5px 10px no-repeat; padding-left: 45px !important; }
复制代码 替换为:- .list th { background: url({IMGDIR}/forum.gif) 3px 17px no-repeat; padding-left: 15px !important; }
复制代码 三、templates/default/discuz.htm 修改
查找:- <tbody id="forum$forum[fid]"> 至 $cat['endrows']
复制代码 全部内容
替换为:- <tbody id="forum$forum[fid]">
- <tr>
- <th$forum[folder]>
- $forum[icon]
- <div class="left">
- <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>
- <!--{if $forum[description]}--><p>$forum[description]</p><!--{/if}-->
- <!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}-->
- </div>
- </td>
- <th class="forumlast"{$forum[folder]}>
- <!--{if $forum['permission'] == 1}-->
- {lang private_forum}
- <!--{else}-->
- <!--{if $forum['redirect']}-->
- <a href="forumdisplay.php?fid=$forum[fid]">{lang url_link}</a>
- <!--{elseif is_array($forum['lastpost'])}-->
- <p> <a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{echo cutstr($forum[lastpost][subject], 26)}</a></p>
- <cite><!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}--> - $forum[lastpost][dateline]</cite>
- <!--{else}-->
- {lang never}
- <p>{lang never}</p>
- <!--{/if}-->
- <!--{/if}-->
- </td>
- </td>
- </tr>
- </tbody>
- <!--{/loop}-->
- <!--{else}-->
- <tr class="narrowlist">
- <!--{loop $cat['forums'] $forumid}-->
- <!--{eval $forum=$forumlist[$forumid];}-->
- <!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
- </tr></tbody>
- <!--{if $forum['orderid'] < $cat['forumscount']}-->
- <tbody><tr>
- <!--{/if}-->
- <!--{/if}-->
- <td width="$cat[forumcolwidth]" style="vertical-align: top; background-image: none; padding:8px !important;">
- <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>
- $forum[icon]
- <h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank"{/if}>$forum[name]</a></h2>
- <!--{if $forum[todayposts]}-->
- <!--{else}-->
- <!--{/if}--></div></div>
- <!--{if $forum[description]}--><div style="width:100%; ">$forum[description]</div><!--{/if}-->
- <!--{if $forum['subforums']}--><div style="width:100%; ">{lang forum_subforums}: $forum['subforums']</div><!--{/if}-->
- <!--{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>
- <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; ">
- <!--{loop ${"new_no".$forum[fid]."_threadlist"} $row}-->
- <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>
- <!--{/loop}-->
- </ul>
- </td>
- <!--{/loop}-->
- $cat['endrows']
复制代码 (造成火狐错位和今日贴量错位的原因在以上这里的修改)
四、templates/default/forumdisplay_subforum.htm 修改
查找:- <!--{if !$forum['forumcolumns']}--> 至 <!--{loop $sublist $sub}-->
复制代码 全部内容
替换为:- <!--{if !$forum['forumcolumns']}-->
- <!--{loop $sublist $sub}-->
- <tbody>
- <tr>
- <td>
- $sub[icon]
- <div class="left">
- <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>
- <!--{if $sub[description]}--><p>版块介绍: $sub[description]</p><!--{/if}-->
- <!--{if $sub['subforums']}--><p>{lang forum_subforums}: $sub['subforums']</p><!--{/if}-->
- </div>
- </td>
- <th class="forumlast"{$forum[folder]}>
- <!--{if $sub['permission'] == 1}-->
- {lang private_forum}
- <!--{else}-->
- <!--{if $sub['redirect']}-->
- <a href="forumdisplay.php?fid=$sub[fid]">{lang url_link}</a>
- <!--{elseif is_array($sub['lastpost'])}-->
- <p>最新主题: <a href="redirect.php?tid=$sub[lastpost][tid]&goto=lastpost#lastpost">{echo cutstr($sub[lastpost][subject], 20)}</a></p>
- <cite><!--{if $sub['lastpost']['author']}-->作者相关: $sub['lastpost']['author']<!--{else}-->作者相关: {lang anonymous}<!--{/if}--> - $sub[lastpost][dateline]</cite>
- <!--{else}-->
- 最新主题: {lang never}
- <p>作者相关: {lang never}</p>
- <!--{/if}-->
- <!--{/if}-->
- </td>
- </tr>
- </tbody>
- <!--{/loop}-->
- <!--{else}-->
- <tr class="narrowlist">
- <!--{loop $sublist $sub}-->
复制代码 至于图片文件,就请到DZ这位朋友的帖下载吧。(人家修改的是收费附件,我也不至于这样断人家财路了...囧)
有朋友要演示,就请看这里吧:http://www.falcomcn.com/bbs/index.php |