[外掛]人氣指數 for phpBB2.0.0
發表於 : 2006-10-14 , 22:46
[外掛]人氣指數 for phpBB2.0.0
--------------------------------------------------------------------------------
http://phpbb-tw.net/phpbb/viewtopic.php?t=5387
--------------------------------------------------------------------------------
http://phpbb-tw.net/phpbb/viewtopic.php?t=5387
代碼: 選擇全部
第一步
開啟viewtopic.php,找到
代碼:
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
在下面加上
代碼:
//
// RPG Ranking Hack by OOHOO
//
$user_id = $postrow[$i]['user_id'];
if($user_id != ANONYMOUS )
{
$sql = "SELECT COUNT(topic_id) AS count_topics, " .
"SUM(topic_replies) AS sum_topic_replies, " .
"SUM(topic_views) AS sum_topic_views " .
"FROM " . TOPICS_TABLE . " " .
"WHERE topic_poster = " . $user_id;
$result = $db->sql_query($sql);
$rr_row = $db->sql_fetchrow($result);
// 發表的主題總數
$count_topics = $rr_row['count_topics'];
// 所有主題的回應總數
$sum_topic_replies = $rr_row['sum_topic_replies'];
// 主題人氣(觀看數)
$sum_topic_views = $rr_row['sum_topic_views'];
$profiledata = get_userdata($postrow[$i]['user_id']);
// 發文總數
$sum_posts = $profiledata['user_posts'];
// 回應文章總數 = 發文總數 - 發表的主題總數
$count_replies = $sum_posts - $count_topics;
// 魅力值 = (發表的主題總數*100 + 所有主題的回應總數*50 + 回應文章數*75 + 主題人氣(觀看數)*2) / (50 + 發文總數)
$rr_hack = ($count_topics * 100 + $sum_topic_replies * 50 + $count_replies * 75 + $sum_topic_views * 2) / (50 + $sum_posts);
// 取小數點後一位
$rr_hack = '人氣指數: <b><font color="#FF6633">' . sprintf("%01.2f", $rr_hack) . '</font></b>';
}
else
{
$rr_hack = "";
}
接著找到
代碼:
'DELETE' => $delpost,
在下面加上
代碼:
'RR_HACK' => $rr_hack, // RPG Ranking Hack by OOHOO
第二步
開啟/templates/template_dirXX/viewtopic_body.tpl,找到
代碼:
{postrow.POSTER_JOINED}<br>
{postrow.POSTER_POSTS}<br>
{postrow.POSTER_FROM}</span><br>
在適當位置加上
代碼:
{postrow.RR_HACK}<br>
完成