[外掛]在首頁顯示最後回覆主題

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

[外掛]在首頁顯示最後回覆主題

文章 動機不明 »

許多論壇程式都有這功能,偏偏 phpbb 沒有,今天偶然看到的,裝了以後感覺不錯,於是分享給大家

來源:http://www.phpbb2-users.de/phpBB/viewtopic.php?t=77

代碼: 選擇全部

######################################################## 
## Mod Title:  last_topic_title_index    
## Mod Version: 1.0.0 
## Author:       Adam Ismay <admin@boardz.tk> 
## Description:  Gives the topic title in the last post box 
##         on index. 
## 
## Installation Level:  fairly easy 
## Installation Time:   3-5 minutes 
## Files To Edit:       index.php 
##            templates/????/index_body.tpl 
######################################################## 
## Notes: Does not do anything on Postgres or Oracle. The topic 
##      title is shortened to 25. This can be changed in the code 
##      or you can add $board_config['topic_title_index_size'] = ??; 
##      in the template config file which will override this 
##      value. Topic titles are not displayed if the user does 
##      not have the right to read the forum. The link goes to 
##      the start of the topic, the existing link to last post is 
##      unaffected. 
######################################################### 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
######################################################### 



# 
#---- [ OPEN ] -------- 
# 

index.php 

# 
#----- [ FIND (line 156) ] ---- 
# 

         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
            FROM (( " . FORUMS_TABLE . " f 
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) 
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) 
            ORDER BY f.cat_id, f.forum_order"; 


# 
#---- [ REPLACE WITH ] ---- 
# 

         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_id 
            FROM ((( " . FORUMS_TABLE . " f 
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) 
            LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_id = p.topic_id ) 
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) 
            ORDER BY f.cat_id, f.forum_order"; 

# 
# --- [ FIND (line 250) ] ---- 
# 

$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data); 

# 
#-----[ REPLACE WITH ] ----- 
# 

   $is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data); 
    if (!isset($board_config['topic_title_index_size'])){ 
       $board_config['topic_title_index_size'] = [color=red]25[/color];  //Set this to size limit 
    } 


# 
# --- [ FIND (line 430) ] ---- 
# 

'MODERATORS' => $moderator_list, 

# 
# ---- [ AFTER, ADD ] --- 
# 

                        'LAST_TOPIC' => $is_auth_ary[$forum_data[$j]['forum_id']]['auth_read'] ? (strlen($forum_data[$j]['topic_title']) > $board_config['topic_title_index_size']) ? substr($forum_data[$j]['topic_title'], 0, ($board_config['topic_title_index_size'] - 2)) . "..." : $forum_data[$j]['topic_title'] : "", 
                        'U_LAST_TOPIC' => append_sid("viewtopic.$phpEx?"  . POST_TOPIC_URL . "=" . $forum_data[$j]['topic_id']), 

# 
#-----[ OPEN ]---- 
# 

templates/subSilver/index_body.tpl 

# 
#----[ FIND ]------- 
# 

   <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td> 

# 
#-----[ REPLACE WITH ]--------- 
# 


   <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall"><a href="{catrow.forumrow.U_LAST_TOPIC}">{catrow.forumrow.LAST_TOPIC}</a><br />{catrow.forumrow.LAST_POST}</span></td> 

# 
#-----[ SAVE ALL FILES ]------------------------------------------ 
# 
# EoM
修改

完成之後由於字數的限制,版面會被撐大一點點,所以請修改紅色的字串,將 25 改為 20 就很完美了! ;)

demo : http://gop.pda.com.tw
最後由 動機不明 於 2002-07-06 12:47 編輯,總共編輯了 1 次。
非官方外掛問題區公告: [必看]請配合發問格式及明確主題發問(2006 02/24更新)
七點要求:
1. 發問前先搜尋,確定沒有重複後再發表
2. 主題要明確
3. 依照發問格式
4. 禁連續推文
5. 請盡量減少使用地方性語言
6. 解決問題後請修改第一篇主題,並感謝曾經幫過你的前輩們 ^^
7. 請不要將檔案內容完整貼出喔! 只要提供問題行及上下各五行就可以了
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

文章 動機不明 »

這是另一個版本的

Topics on index (Customisable)
http://www.phpbbhacks.com/viewhack.php?id=1545


此外掛除了在首頁顯示最後回覆外,控制台另外可以設定共要顯示多少字元出來 (預設為30)
非官方外掛問題區公告: [必看]請配合發問格式及明確主題發問(2006 02/24更新)
七點要求:
1. 發問前先搜尋,確定沒有重複後再發表
2. 主題要明確
3. 依照發問格式
4. 禁連續推文
5. 請盡量減少使用地方性語言
6. 解決問題後請修改第一篇主題,並感謝曾經幫過你的前輩們 ^^
7. 請不要將檔案內容完整貼出喔! 只要提供問題行及上下各五行就可以了
主題已鎖定

回到「非官方認證外掛」