原帖:http://www.freediscuz.net/phpbbs/viewthread.php?tid=15382
插件:子論壇顯示新方式
修改:forumdisplay.php
修改: forumdisplay.htm
替換: forumdisplay_subforum.htm
新增: forumdisplay_fatherforum.htm
思路提供: Freediscuz 會員
制作修改: Freediscuz cnteacher
中文化:BenLeung
發布日期: 20040518
難易程度: 簡
一、安裝之前的准備,
首先准備2個按鈕圖片,利用專用工具將他切分成左中右三個部分。并且分別名為
cleft,cm,cright dleft,dm,dright.上傳到論壇的images目錄。
壓縮包里面提供了一個比較簡單的范例。你可以直接使用。
二、修改forumdisplay.php
1、查找:
$subexists = $subthreads = 0;
替換為:
$subexists = $subthreads = $fatherexists = $fnum=0;
2、查找:
if($subexists ) {
$subexists = 0;
$sublist = array();
$querys = $db->query("SELECT * FROM $table_forums WHERE status='1' AND type='sub' AND fup='$fid' ORDER BY displayorder");
while($sub = $db->fetch_array($querys)) {
$subexists = 1;
$subthreads += $sub['threads'];
forum($sub);
$sublist[] = $sub;
}
}
用下面代碼替換
if($subexists ) {
$subexists = 0;
$sublist = array();
$querys = $db->query("SELECT * FROM $table_forums WHERE status='1' AND type='sub' AND fup='$fid' ORDER BY displayorder");
while($sub = $db->fetch_array($querys)) {
$subexists = 1;
$subthreads += $sub['threads'];
forum($sub);
$sublist[] = $sub;
}
}elseif($forum['type']=='sub'){
$fatherlist=array();
foreach($_DCACHE['forums'] as $father) {
if($father['type'] == 'sub' && $father['fup'] == $forum['fup']) {
$fnum++;
$fatherexists = 1;
forum($father);
$fatherlist[] = $father;
}
}
}
三、修改forumdisplay.htm
1、查找 和刪除
<!--{if $subexists}-->
{template forumdisplay_subforum}
<!--{/if}-->
2、查找:
<table width="{TABLEWIDTH}" cellspacing="0" cellpadding="0" align="center">
<tr><td class="multi">$multipage</td>
<td align="right">
<a href="post.php?action=newthread&fid=$fid"><img src="{IMGDIR}/newtopic.gif" border="0"></a>
<!--{if $allowpostpoll}--> <a href="post.php?action=newthread&fid=$fid&poll=yes"><img src="{IMGDIR}/poll.gif" border="0"></a><!--{/if}-->
</td></tr></table>
這段代碼,你可以刪除掉,也可以保留。我的論壇是給刪除了,但是也失去了上面發貼按鈕。
如果你刪除了這段代碼,在這段代碼的位置添加下面的內容。
如果你沒有刪除,那么在這段代碼的后面直接添加下面的內容就可以了。
<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center" >
<tr><td>
<table cellspacing="0" cellpadding="0" >
<tr >
<!--{if $subexists}-->
{template forumdisplay_subforum}
<!--{/if}-->
<!--{if $fatherexists}-->
{template forumdisplay_fatherforum}
<!--{/if}-->
</tr></table></table>
三、上傳壓縮保里面的兩個模版文件到你的模版目錄,覆蓋掉以前的。
四、安裝完畢。
=================================================================
關于新的子論壇排列方式的實用技巧和提示
=================================================================
1、雖然是修改了forumdisplay.php 這個程序文件,但是大家不要擔心,因為這個修
改和以前的顯示方式兼容。所以如果你的論壇有多個風格,其他風格如果采用的模版不是
你剛才修改的,那么當你的論壇使用另外一個風格去瀏覽的時候,會自動轉回原來的樣子。
不會出現數據錯誤。
2、此種顯示方式適合子論壇在2-8個左右的情況,如果子論壇很多,或者每個子論壇的名
字都很長。那么可能會沒有現在這么美觀了。
3、forumdisplay.php 的修改給大家留下了功能擴充的余地。你可通過修改模版,添加
你想要的內容,例如現在這種方式去掉了子論壇的貼子數量顯示、子論壇的介紹、子論壇
的最后發貼。其實你完全可以通過修改 forumdisplay_subforum.htm 來達到目的,
例如你可設定成將鼠標放上去,顯示那些東西。
4、加入自己創造的東西才是真正符合你自己需要的,但愿這個小東西給大家提供一個思路。
如果你樂意讓大家分享你的修改,不妨美化修飾以后將你的創意發布出來。
[ Last edited by BenLeung on 2004-9-6 at 16:27 ]