在首頁顯示最後回覆主題

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

御津闇慈
竹貓忠實會員
竹貓忠實會員
文章: 645
註冊時間: 2001-11-17 10:59

文章 御津闇慈 »

圖檔
進階功能(有跟沒有速一樣啦~_~)

代碼: 選擇全部

######################################################## 
## 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 
    } 
[color=#1100ff]if (!isset($board_config['topic_title_index_size2'])){ 
       $board_config['topic_title_index_size2'] =[/color]40 [color=#1100ff];  //Set this to size limit 
    } [/color]

# 
# --- [ 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'] : "", 
[color=#1100ff]'K_LAST_TOPIC' => $is_auth_ary[$forum_data[$j]['forum_id']]['auth_read'] ? (strlen($forum_data[$j]['topic_title']) > $board_config['topic_title_index_size2']) ? substr($forum_data[$j]['topic_title'], 0, ($board_config['topic_title_index_size2'] - 2)) . "..." : $forum_data[$j]['topic_title'] : "", 
[/color]
                  '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}[color=#1100ff]" title="{catrow.forumrow.K_LAST_TOPIC}" [/color]>{catrow.forumrow.LAST_TOPIC}</a><br />{catrow.forumrow.LAST_POST}</span></td> 

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

已經安裝過又想再進階的話請參照藍色的字
綠色的40數是隨你改~~但是不要超過50以上就好~~不然變的粉難看
不過...假如太長文章的話提示列還速會"喀喳"的啦(所以我說有沒沒有都麻一樣咩~_~)
頭像
貧乏神DX
星球公民
星球公民
文章: 60
註冊時間: 2002-06-24 16:10
聯繫:

文章 貧乏神DX »

謝謝闇兄
嘩嘩 , 又出錯 !!!
唉 ~ 又要再改了 ~_~||
Ring
星球普通子民
星球普通子民
文章: 21
註冊時間: 2002-05-29 17:36
來自: B612號行星
聯繫:

文章 Ring »

我剛剛把

代碼: 選擇全部

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
				WHERE p.post_id = f.forum_last_post_id 
					AND u.user_id = p.poster_id  
					UNION (
						SELECT f.*, NULL, NULL, NULL, NULL
						FROM " . FORUMS_TABLE . " f
						WHERE NOT EXISTS (
							SELECT p.post_time
							FROM " . POSTS_TABLE . " p
							WHERE p.post_id = f.forum_last_post_id  
						)
					)
					ORDER BY cat_id, forum_order";

代碼: 選擇全部

$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"; 
搞錯了..
花了一整個下午的時間才改好..
只能怪自己真是笨!! :cry:
不過還是成功了~
感謝分享喔!!
rolcoco
星球普通子民
星球普通子民
文章: 10
註冊時間: 2003-04-30 17:54

文章 rolcoco »

請問一下

如果我想把最後發表的文章

顯示在另外一頁(我的首頁裡面)

該怎麼作呢?(PS我的首頁跟PHPBB放在同一台主機上)
godfreychan
星球公民
星球公民
文章: 86
註冊時間: 2003-05-23 10:57

文章 godfreychan »

改完了最早POST的code
但沒有顯示出來
為什么???
rolcoco
星球普通子民
星球普通子民
文章: 10
註冊時間: 2003-04-30 17:54

文章 rolcoco »

rolcoco 寫:請問一下

如果我想把最後發表的文章

顯示在另外一頁(我的首頁裡面)

該怎麼作呢?(PS我的首頁跟PHPBB放在同一台主機上)
有位工程師告訴我說 要這樣做要寫另外一支程式
到資料表裡把資料給抓出來
是不是很麻煩啊
從頭開始學php大概要學多久才做得到這樣的地步

污污
主題已鎖定

回到「外掛問題討論」