1 頁 (共 1 頁)

[外掛] Hot-forum (熱門討論區,簡易版)

發表於 : 2004-06-22 12:46
22183389
之前有人做過,不過都不能使用=.=我修改一下後釋出\r
準備開始

代碼: 選擇全部


====[ 打開 ]=====
viewforum.php
====[ 找到 ]=====
// End initial var setup
====[ 下面加入 ]=====
//熱門討論區列表\r

$sql = "UPDATE `phpbb_forums` 
SET forums_hot =  forums_hot + 1
WHERE `forum_id` = '$forum_id'"; 
if ( !($result = $db->sql_query($sql)) ) 
{ 
message_die(GENERAL_ERROR, '無法連接資料庫取得熱門討論區列表', '', __LINE__, __FILE__, $sql); 
}
====[ 儲存,關閉 ]=====




====[ 打開 ]=====
viewtopic.php
====[ 找到 ]=====
$sql = "SELECT t.topic_id, t.topic_title, 
====[ 同一行中搜尋 ]=====
f.forum_name, 
====[ 同一行中後面加入 ]=====
f.forums_hot, 
====[ 找到 ]=====
//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
====[ 下面加入 ]=====
//熱門討論區列表 

$sql = "UPDATE `phpbb_forums` 
SET forums_hot =  forums_hot + 1
WHERE `forum_id` = '$forum_id'"; 
if ( !($result = $db->sql_query($sql)) ) 
{ 
message_die(GENERAL_ERROR, '無法連接資料庫取得熱門討論區列表', '', __LINE__, __FILE__, $sql); 
}
====[ 儲存,關閉 ]=====

====[ 打開 ]=====
index.php
====[ 找到 ]=====
// Generate the page
====[ 下面加入 ]=====
//熱門討論區列表\r

$hotforum_sql="SELECT * FROM phpbb_forums ORDER BY `hot_views` DESC LIMIT 0,5"; 
  
$hotforum_result = $db->sql_query($hotforum_sql); 
while (($line = mysql_fetch_array($hotforum_result))) 
{ 
$template->assign_block_vars('forum_hot', array( 
'FORUM_ID' => $line['forum_id'], 
'FORUM_NAME' =>$line['forum_name'],        
'FORUM_HOTVIEWS' => $line['hot_views'], 
));
} 
====[ 儲存,關閉 ]=====






====[ 打開 ]=====
index_body.tpl
====[ 最上面加入 ]=====
//熱門討論區列表\

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
<tr> 
<td class="row2" height="25"colspan="2"><b>熱門討論區</b></td> 
</tr> 
<!-- BEGIN forum_hot --> 
<td class="row1" align="left" valign="middle"><span class="gensmall"><a href="viewforum.php?f={hot_forum.FORUM_ID}">{hot_forum.FORUM_NAME}</a></span></td> 
<td class="row1" align="left" valign="middle"><span class="gensmall">{hot_forum.FORUM_HOTVIEWS}</span></td> 
</tr> 
<!-- END forum_hot --> 
</table> 
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table> 
<br />
====[ 儲存,關閉 ]=====



過兩天我在貼出進階版=.=....
1.點熱門討論區會show出熱門討論區的list
2.這只是人氣數比較,將會增加文章數最多的,類gamebase
3.可以在後台設定幾天後自動清空 ,類gamebase