 |
 |
5883988
0040023
頭銜: Lord

帖子: 347

精華:
0

積分: 2410 點

現金: 115 元

存款: 1000 元

閱讀權限: 25

註冊: 2006-2-14

來自: 嶺 東 學 園

狀態: 離線

|
|
 |
|
 |
|
|
|
增加主題分類 4~6格都適用 5.0 5.5 6.0
原帖:不明 (很多人修改又修改)
參考修改帖: http://www.discuz.net/viewthread ... hlight=%CE%E5%B8%F1
參考修改帖: http://www.alan888.com/Discuz/thread-133625-1-1.html
綜合修改者:5883988
演示:
[attach]61994[/attach]
主要分類 歸類首頁顯示
需要後台版塊有設定分類
才會在首頁中顯示
如果沒分類 不會在首頁顯示
此修改適用於DZ5.0、DZ5.5、DZ6.0首頁4格、5格、6格
注意:請記得每次覆蓋或改寫文件前一定要先備份原修改文件(以便錯誤後反正)
如修改出現錯誤 本人不負任何責任
1.打開 index.php
查找: 新帖 或 新文章 或 最新主題 下的
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
改成:
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.dateline DESC LIMIT 0, 10");
$query1 = $db->query("SELECT a.name,b.typeid FROM {$tablepre}threadtypes a, {$tablepre}threads b where b.typeid=a.typeid AND b.fid not in (0) AND b.displayorder not in (-1,-2) ORDER BY b.dateline DESC LIMIT 0, 10");
while(($nthread = $db->fetch_array($query))&&($ntypeids = $db->fetch_array($query1))) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime'] = gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
$nthread['typename'] = $ntypeids['name'];
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
查找:回復 或 回覆 或 最新回覆 下的
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 10");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
改成:
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 10");
$query1 = $db->query("SELECT a.name,b.typeid FROM {$tablepre}threadtypes a, {$tablepre}threads b where b.typeid=a.typeid AND b.closed NOT LIKE 'moved|%' AND b.replies !=0 AND b.fid not in (0) AND b.displayorder not in (-1,-2) ORDER BY b.lastpost DESC LIMIT 0, 10");
while(($rthread = $db->fetch_array($query))&&($rtypeids = $db->fetch_array($query1))) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
$rthread['typename'] = $rtypeids['name'];
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
查找:熱帖 或 熱門帖 或 本週/月熱門 下的
$new_hot_threadlist = array();
$mthread = array();
$ctime=$timestamp-3600*24*7;//最後7是天數為本周
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND t.dateline>$ctime AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
while($mthread = $db->fetch_array($query)) {
$mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
$mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
$mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
$mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
$mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
if($mthread['highlight']) {
$string = sprintf('%02d', $mthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$mthread['highlight'] = 'style="';
$mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$mthread['highlight'] .= '"';
} else {
$mthread['highlight'] = '';
}
$new_hot_threadlist[] = $mthread;
}
改成:
$new_hot_threadlist = array();
$mthread = array();
$ctime=$timestamp-3600*24*7;//最後7是天數為本周
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND t.dateline>$ctime AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.replies DESC LIMIT 0, 10");
$query1 = $db->query("SELECT a.name,b.typeid FROM {$tablepre}threadtypes a, {$tablepre}threads b where b.typeid=a.typeid AND b.closed NOT LIKE 'moved|%' AND b.replies !=0 AND b.dateline>$ctime AND b.fid not in (0) AND b.displayorder not in (-1,-2) ORDER BY b.replies DESC LIMIT 0, 10");
while(($mthread = $db->fetch_array($query))&&($mtypeids = $db->fetch_array($query1))) {
$mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
$mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
$mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
$mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
$mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
$mthread['typename'] = $mtypeids['name'];
if($mthread['highlight']) {
$string = sprintf('%02d', $mthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$mthread['highlight'] = 'style="';
$mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$mthread['highlight'] .= '"';
} else {
$mthread['highlight'] = '';
}
$new_hot_threadlist[] = $mthread;
}
2.打開您修改discuz.htm或新增的foruminfo.htm
查找: <!--{loop $new_post_threadlist $nthread}-->………中間因為4~6格不一樣所以我省略~但是頭尾不變………<!--{/loop}-->
改成: <!--{loop $new_post_threadlist $nthread}-->
<!--{if $nthread[replies]}-->
<div style="overflow: hidden;height: 20px;width: 100%;">[<a href='forumdisplay.php?fid=$nthread[fid]&filter=type&typeid=$nthread[typeid]'><span style="color:#666666">$nthread[typename]</span></a>] <a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='所在論壇: $nthread[forumname]{LF}主題標題: $nthread[subject] {LF}主題作者: $nthread[author]{LF}發表時間: $nthread[date]{LF}瀏覽次數: $nthread[views] 次 {LF}回覆次數: $nthread[replies] 次{LF}最後回覆: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]'>$nthread[view_subject]</a></div>
<!--{else}-->
<div style="overflow: hidden;height: 20px;width: 100%;">[<a href='forumdisplay.php?fid=$nthread[fid]&filter=type&typeid=$nthread[typeid]'><span style="color:#666666">$nthread[typename]</span></a>] <a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='所在論壇: $nthread[forumname]{LF}主題標題: $nthread[subject] {LF}主題作者: $nthread[author]{LF}發表時間: $nthread[date]{LF}瀏覽次數: $nthread[views] 次 {LF}回覆次數: $nthread[replies] 次{LF}最後回覆: 暫時沒有回覆'>$nthread[view_subject]</a></div>
<!--{/if}-->
<!--{/loop}-->
查找: <!--{loop $new_reply_threadlist $rthread}-->………中間因為4~6格不一樣所以我省略~但是頭尾不變………<!--{/loop}-->
改成:: <!--{loop $new_reply_threadlist $rthread}-->
<div style="overflow: hidden;height: 20px;width: 100%;">[<a href='forumdisplay.php?fid=$nthread[fid]&filter=type&typeid=$rthread[typeid]'><span style="color:#666666">$rthread[typename]</span></a>] <a href="redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost" $rthread['highlight'] title='所在論壇: $rthread[forumname]{LF}主題標題: $rthread[subject]{LF}主題作者: $rthread[author]{LF}發表時間: $rthread[date]{LF}瀏覽次數: $rthread[views] 次{LF}回覆次數: $rthread[replies] 次{LF}最後回覆: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></div>
<!--{/loop}-->
查找: <!--{loop $new_hot_threadlist $mthread}-->………中間因為4~6格不一樣所以我省略~但是頭尾不變………<!--{/loop}-->
改成: <!--{loop $new_hot_threadlist $mthread}-->
<div style="overflow: hidden;height: 20px;width: 100%;">[<a href='forumdisplay.php?fid=$nthread[fid]&filter=type&typeid=$mthread[typeid]'><span style="color:#666666">$mthread[typename]</span></a>] <a href="viewthread.php?tid=$mthread[tid]" $mthread['highlight'] title='所在論壇: $mthread[forumname]{LF}主題標題: $mthread[subject]{LF}主題作者: $mthread[author]{LF}發表時間: $mthread[date]{LF}瀏覽次數: $mthread[views] 次{LF}回覆次數: $mthread[replies] 次{LF}最後回覆: $mthread[lastreplytime]{LF}{lang lastpost}: $mthread[lastposter]'>$mthread[view_subject]</a></div>
<!--{/loop}-->
完成∼
最後:請記得每次覆蓋或改寫文件後一定要更新緩存
[ 本帖最後由 5883988 於 2008-6-5 09:53 編輯 ]
附件: 您所在的用戶組無法下載或查看附件
| |