[譯文:MOD] 在 ezPortal 中顯示 Top 5

phpBB 大部分皆是由竹貓星球提供資料!
頭像
yehrussell
忍辱、精進、靜慮、般若波羅密
忍辱、精進、靜慮、般若波羅密
主題中的帖子: 1
文章: 1133
註冊時間: 2006-01-20 , 10:19
個人狀態: 非常忙碌中!
性別: 公仔

[譯文:MOD] 在 ezPortal 中顯示 Top 5

未閱讀文章 yehrussell »

[譯文:MOD] 在 ezPortal 中顯示 Top 5

This adds three new blocks to ezPortal, they are Recent, Topics, and Viewed.
They all show the 5 top topics.
Much of the code is taken from index.php
This is easy to install, and will be updated first on this site.

這將在由 Smartor 所寫的 ezPortal 中顯示最後發表、最多回覆和最多人觀看的 5 篇主題
大部分的程式碼取自 index.php
這個外掛很容易安裝,而且會在我的站上使先發佈更新檔

代碼: 選擇全部

############################################################## 
## MOD Title: Top 5 ezPortal blocks 
## 外掛名稱: 在 ezPortal 中顯示 Top 5 
## 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: Top 5 Topics, Top 5 Viewed, Last 5 topics 
## 外掛描述: 顯示最後發表、最多回覆和最多人觀看的 5 篇主題  
## MOD Version: 1.0.0 
## 外掛版本: 1.0.0 
## 
## Installation Level: Easy. 
## 安裝難度: 簡易 
## Installation Time: 5 Minutes 
## 安裝時間: 5 分鐘 
## Files To Edit: portal.php, portal_body.tpl 
## 修改檔案: portal.php, portal_body.tpl 
## Included Files: N/A 
## 附加檔案: 無 
############################################################## 
## 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/ 是否有此外掛的最新版本 
## 從其他地方下載此檔可能會造成你在你的 phpBB 討論版上寫入有誤的程式碼 r
## 基於這個理由,phpBB 將不會為沒有收藏在我們的外掛資料庫的外掛提供支援 
## 我們的外掛資料庫在 http://www.phpbb.com/mods/downloads/ 
## 
############################################################## 
## Author Notes: Just a few more pointless portal blocks. 
## Just adds more to your pages. ;) 
## 
## 作者留言: 讓你的入口頁顯示更多資訊 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
## 
## 在你加入這個外掛前,你應該把所有與這個外掛有關的檔案進行備份 
############################################################## 

# 
#-----[ OPEN 打開 ]------------------------------------------ 
# 
portal.php 
# 
#-----[ FIND 尋找 ]------------------------------------------ 
# 
// Generate the page 
# 
#-----[ BEFORE ADD 之前加上 ]------------------------------------------ 
# 
// Let's add some more code, this will be fun. ;) 
$active_topics_sql="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time 
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
            and d.forum_id=a.forum_id 
            and d.auth_view=0 
         ORDER BY topic_last_post_id DESC 
         LIMIT 5"; 
$active_topics = $db->sql_query($active_topics_sql); 

$active_topics_sql2="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time 
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
            and d.forum_id=a.forum_id 
            and d.auth_view=0 
         ORDER BY topic_replies DESC 
         LIMIT 5"; 
$active_topics2 = $db->sql_query($active_topics_sql2); 

$active_topics_sql3="SELECT a.topic_id,a.topic_title,  a.topic_views, a.topic_replies,  a.topic_last_post_id, c.post_time 
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
            and d.forum_id=a.forum_id 
            and d.auth_view=0 
         ORDER BY topic_views DESC 
         LIMIT 5"; 
$active_topics3 = $db->sql_query($active_topics_sql3); 

   while (($line = mysql_fetch_array($active_topics)) and ($line2 = mysql_fetch_array($active_topics2)) and ($line3 = mysql_fetch_array($active_topics3))) 
   { 
      if (strlen($line['topic_title']) > 40) 
      { 
         $line_topic_title = substr($line['topic_title'], 0, 40)." ..."; 
      } 
      else 
      { 
         $line_topic_title = $line['topic_title']; 
      } 
      if (strlen($line2['topic_title']) > 40) 
      { 
         $line_topic_title2 = substr($line2['topic_title'], 0, 40)." ..."; 
      } 
      else 
      { 
         $line_topic_title2 = $line2['topic_title']; 
      } 
      if (strlen($line3['topic_title']) > 40) 
      { 
         $line_topic_title3 = substr($line3['topic_title'], 0, 40)." ..."; 
      } 
      else 
      { 
         $line_topic_title3 = $line3['topic_title']; 
      } 
      $lastpost = "<a href="".$phpbb_root_path."viewtopic.php?t=" . $line['topic_id'] . "" title="" . $line['topic_title'] ."">" . $line_topic_title . "</a>"; 
      $poppost = "<a href="".$phpbb_root_path."viewtopic.php?t=" . $line2['topic_id'] . "" title="" . $line2['topic_title'] ."">" . $line_topic_title2 . "</a>"; 
      $poppostc = $line2['topic_replies']; 
      $popviewpost = "<a href="".$phpbb_root_path."viewtopic.php?t=" . $line3['topic_id'] . "" title="" . $line3['topic_title'] ."">" . $line_topic_title3 . "</a>"; 
      $popviewpostc = $line3['topic_views']; 
      $template->assign_block_vars('topicrecentpopular', array( 
         'TOPICSPOPULAR' => $poppost, 
         'TOPICSPOPULARC' => $poppostc, 
         'TOPICSPOPULARVIEW' => $popviewpost, 
         'TOPICSPOPULARVIEWC' => $popviewpostc, 
         'TOPICSRECENT' => $lastpost) 
      ); 
   } 
// You added more pointless code, go you! 
# 
#-----[ OPEN 打開 ]------------------------------------------ 
# 
portal_body.tpl 
# 
#-----[ FIND 尋找 ]------------------------------------------ 
# 
        <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
         <tr> 
         <td class="catHead" height="25"><span class="genmed"><b>{L_POLL}</b></span></td> 
         </tr> 
         <tr> 
         <td class="row1" align="left"><span class="gensmall"> 
            <form method="post" action="{S_POLL_ACTION}"> 
            <center><b>{S_POLL_QUESTION}</b></center><br /> 
            <!-- BEGIN poll_option_row --> 
            <input type="radio" name="vote_id" value="{poll_option_row.OPTION_ID}">{poll_option_row.OPTION_TEXT} [{poll_option_row.VOTE_RESULT}]<br /> 
            <!-- END poll_option_row --> 
            <br /> 
            <!-- BEGIN switch_user_logged_out --> 
            <center>{L_LOGIN_TO_VOTE}</center> 
            <!-- END switch_user_logged_out --> 
            <!-- BEGIN switch_user_logged_in --> 
            <center><input type="submit" class="mainoption" name="submit" value="{L_VOTE_BUTTON}" {DISABLED}></center> 
            <input type="hidden" name="topic_id" value="{S_TOPIC_ID}"> 
            <input type="hidden" name="mode" value="vote"> 
            <!-- END switch_user_logged_in --> 
            {S_HIDDEN_FIELDS} </form><br /> 
         </span></td> 
         </tr> 
        </table> 
        
        <br /> 
# 
#-----[ BEFORE ADD 之前加上 ]------------------------------------------ 
# 
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
  <tr> 
   <td class="cathead" colspan="4" align="left" height="25"><span class="genmed"><b>Top 5 Recent Topics</b></span></td> 
  </tr> 
<!-- BEGIN topicrecentpopular --> 
   <td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSRECENT}</span></td> 
  </tr> 
  <!-- END topicrecentpopular --> 
</table> 
<br /> 
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
  <tr> 
   <td class="cathead" colspan="4" align="left" height="25"><span class="genmed"><b>Top 5 Topics</b></span></td> 
  </tr> 
<!-- BEGIN topicrecentpopular --> 
  <tr> 
   <td width="31%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULAR}</span></td> 
   <td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARC}</span></td> 
  </tr> 
  <!-- END topicrecentpopular --> 
</table> 
<br /> 
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
  <tr> 
   <td class="cathead" colspan="4" align="left" height="25"><span class="genmed"><b>Top 5 Viewed</b></span></td> 
  </tr> 
<!-- BEGIN topicrecentpopular --> 
  <tr> 
   <td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEW}</span></td> 
   <td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEWC}</span></td> 

  </tr> 
  <!-- END topicrecentpopular --> 
</table> 
<br /> 
# 
#-----[ SAVE/CLOSE ALL FILES 儲存並且關閉所有檔案 ]------------------------------------------ 
# 
# EoM 
# 外掛結束 
六度梵行
版面鎖定 主題已鎖定

回到「phpBB2」