[phpBB2 譯文:MOD] 顯示發文最多的會員在首頁或ezPortal

與 phpBB 2.0.x 相關主題。
回覆文章
Mac
百戰天龍馬蓋先
百戰天龍馬蓋先
文章: 2590
註冊時間: 2003-02-02 02:28
來自: MacphpBBMOD
聯繫:

[phpBB2 譯文:MOD] 顯示發文最多的會員在首頁或ezPortal

文章 Mac »

This will display a list of the top 5 posters on the forum index, or ezPortal by Smartor
The demo is shown on this site, on my portal, although I have removed the bar to reduce laod time. This is easy to install, and will be updated first on this site.

這將在首頁或 由 Smartor 所寫的 ezPortal 中顯示發文最多的 5 位會員\r
Demo 將可以在我的網站的入口頁找到,但我移除了圖示顯示來減少開啟時間。這個外掛很容易安裝,而且會在我的站上使先發佈更新檔

代碼: 選擇全部

############################################################## 
## MOD Title: Top posters on index or ezPortal
## 外掛名稱: 顯示發文最多的會員在首頁或 ezPortal
## MOD Author: Antony, antony_bailey@lycos.co.uk, Antony Bailey, http://rapiddr3am.slackslash.net
## 外掛作者: Antony, antony_bailey@lycos.co.uk, Antony Bailey, http://rapiddr3am.slackslash.net 
## 中文譯者: Mac < ycl_6@sinamail.com > http://phpbb-tw.net/, http://endless-tw.net/
## MOD Description: Displays the top posters with a percentage on index or portal.
## 外掛描述: 這可以顯示發文最多會員以及文章所佔的比率在討論版首頁或入口頁
## MOD Version: 0.0.1
## 外掛版本: 0.0.1
## 
## Installation Level: Easy
## 安裝難度: 簡易
## Installation Time: 3 Minutes 
## 安裝時間: 3 分鐘
## Files To Edit: index.php or portal.php index_body.tpl or portal_body.tpl
## 修改檔案: index.php or portal.php index_body.tpl or portal_body.tpl
## Included Files: n/a
## 附加檔案: 無\r
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
##
## 由於安全上的考量,請檢查:
## http://www.phpbb.com/mods/downloads/ 是否有此外掛的最新版本\r
## 從其他地方下載此檔可能會造成你在你的 phpBB 討論版上寫入有誤的程式碼\r
## 基於這個理由,phpBB 將不會為沒有收藏在我們的外掛資料庫的外掛提供支援\r
## 我們的外掛資料庫在 http://www.phpbb.com/mods/downloads/
##
############################################################## 
## Author Notes: Different people want it in different places so I'm not specifing were to put it.
## 
## 作者留言: 由於大家想要的顯示位置不同,所以我將不指明需要把外掛插在哪裡
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##
## 在你加入這個外掛前,你應該把所有與這個外掛有關的檔案進行備份\r
############################################################## 

# 
#-----[ OPEN 打開 ]------------------------------------------ 
# 
index.php or portal.php

index.php 或 portal.php
# 
#-----[ FIND 尋找 ]------------------------------------------ 
# 
// Fenerate page
# 
#-----[ BEFORE ADD 之前加上 ]------------------------------------------ 
# 
// Start Top 5 Posters hack 
$sql = "SELECT post_id FROM " . POSTS_TABLE . " ORDER BY post_id DESC LIMIT 1"; 
$result = $db->sql_query($sql); 
$row = $db->sql_fetchrow($result); 
$total_post_perc = $row['post_id']; 
$perc_mult = 3; 
$perc_mult_set = 0; 
$rank = 0; 
$sql = "SELECT user_id, username, user_posts FROM " . USERS_TABLE ." WHERE user_id <> -1 ORDER BY user_posts DESC LIMIT 5"; 
$result = $db->sql_query($sql); 
while( $row = $db->sql_fetchrow($result)) { 
   $rank++; 
   if (!($rank % 2)) $class = 'row2'; else $class= 'row1'; 
   $percentage = round(100 * $row['user_posts'] / get_db_stat('postcount'),0); 
   $bar_perc = round($percentage * $perc_mult,0); 
   $template->assign_block_vars("users", array( 
      'RANK' => $rank, 
      'CLASS' => $class, 
      'USERNAME' => $row['username'], 
      'PERCENTAGE' => $percentage, 
      'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'], 
      'BAR' => $bar_perc, 
      'POSTS' => $row['user_posts']) 
   ); 
} 
// End Top 5 Posters hack 
# 
#-----[ OPEN 打開 ]------------------------------------------ 
#
portal_body.tpl or index_body.tpl

portal_body.tpl 或 index_body.tpl
# 
#-----[ ADD WERE REQUIRED 加在你想要的地方 ]------------------------------------------ 
#
      <br /> 

        <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
         <tr> 
         <td class="rowpic" colspan="4" align="left" height="25"><span class="genmed"><b>Top 5 Posters</b></span></td> 
         </tr> 
         <tr> 
         <td class="row1" align="center"><span class="genmed">Member</span></td> 
         <td class="row1" align="center"><span class="genmed">Posts</span></td>    
         <td class="row1" align="center"><span class="genmed">Percent</span></td>    
         <td class="row1" align="center"><span class="genmed">Graph</span></td> 
         </tr> 
         <tr> 
      <!-- BEGIN users --> 
         <td class="row1" align="left"><span class="gensmall"><a href="{users.URL}"> {users.USERNAME}</a></span></td> 
         <td class="row1" align="center"><span class="gensmall"><b>  {users.POSTS}</b></span></td>    
         <td class="row1" align="center"><span class="gensmall">  {users.PERCENTAGE}%</span></td>    
         <td class="row1" align="left"> <img src="templates/subSilver/images/voting_bar.gif" height="10" width="{users.BAR}%"></td> 
         </tr> 
      <!-- END users --> 
        </table> 

# 
#-----[ SAVE/CLOSE ALL FILES 儲存並且關閉所有檔案 ]------------------------------------------ 
# 
# EoM
# 外掛結束
+ 關於 phpBB 使用問題請在版面發問,私人訊息提供其他不相干或是隱私的事情聯絡之用。

phpBB 官網 | 竹貓星球 | MacphpBBMOD | 我的服務
回覆文章

回到「2.0」