本帖最后由 bnzzy 于 2009-10-27 19:06 编辑
应大家的强烈要求,本插件免费提供
首页直排美化For DZ 7.1
演示网站:www.bnzzy.net
作者:不详
========================================================================
安装步骤如下:
-------------------------------------------------------------------------
一、修改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>
<td>
$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'}--><img src="{IMGDIR}/moderator.gif" title="论坛版主" onclick="toggle_collapse('coll_1');" style="cursor:pointer" /> <em class="moderators" id="coll_1" style="display:none">$forum[moderators]</em><!--{/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>
</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="width:100%; "><div style="float:left; "><h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank" {/if}>$forum[name]</a></h2></div><div style="float:right; "><!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="{IMGDIR}/moderator.gif" title="论坛版主" onclick="toggle_collapse('coll_2');" style="cursor:pointer" /> <em class="moderators" id="coll_2" style="display:none">$forum[moderators]</em><!--{/if}--><!--{/if}-->
<!--{if $forum[todayposts]}-->
<!--{else}-->
<!--{/if}--></div></div>
$forum[icon]
<!--{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]}-->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>
<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']}-->今日: <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> <!--{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}-->
-------------------------------------------------------------------------
最后将images文件夹上传至根目录覆盖源文件。
下载地址:
|