1 頁 (共 1 頁)

TOP5放進Protal的問題(已解決)

發表於 : 2006-02-01 00:40
yuei
問題外掛:TOP5
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php ... 4%F4%A6%E2
使用版本:phpbb2.0.19 UTF-8
網站位置:抱歉,目前還在單機測試
狀況描述:

請教一下個位前輩\r
我已經順利的將TOP5放進portal中,也順利的將UTF-8碼的亂碼解決了

請問,我想在TOP5顯示的主題後面,增加他的所在討論區位置\r
有點像是http://www.gamer.com.tw/
這樣\r

我該怎麼做呢?
這是我portal中的原始碼,順便提供給有須要將TOP5放進portal的人\r

代碼: 選擇全部

            <?php
define('FORUMS_TABLE', 'phpbb_forums'); 
define('TOPICS_TABLE', 'phpbb_topics'); 
   define('IN_PHPBB', true); 
   $phpbb_root_path = './'; 
   include($phpbb_root_path . 'config.php'); 
   include($phpbb_root_path . 'extension.inc'); 
   include($phpbb_root_path . 'includes/db.'.$phpEx); 

// 
// Mod setting 
// 
// Topics text length 
//$MAX_STR_LEN = 100; 
// Topics to display 
$MAX_TOPICS = 5; 
// 0 => users can see all topics including authorized issue(but they cant read the posts) 
// 1 => users can see only authorized topics 


function cutStr($str) { 

   global $MAX_STR_LEN; 

   $str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, 50) . ' ...') : $str; 
   return $str; 
} 


$sql = "SELECT topic_id, topic_title
   FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
   WHERE t.forum_id = f.forum_id
   AND t.topic_moved_id = '0' and f.auth_view=0 and t.topic_type = '0' 
   ORDER BY t.topic_replies DESC LIMIT 0, $MAX_TOPICS"; 
   

if( !$result = $db->sql_query($sql) ) 
{ 
   echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>'; 
   exit; 
} 


// fetch rows 
while( $rows = $db->sql_fetchrow($result) ) 
{ 
   echo "<tr><td><font size='-1'><a href=\"./viewtopic.php?t=".$rows['topic_id']."\" target=\"_blank\">".cutStr($rows["topic_title"])."</a></td></tr>"; 
} 
$db->sql_freeresult($rows); 
$db->sql_close(); 
?>

發表於 : 2006-02-01 11:19
心靈捕手
我猜想:
如果以您原先參考的文章, 修改後, 有顯示出 topic_title 的話,
那麼應該也不難顯示出 forum_id 吧!

建議您:
參考這個討論串:
http://phpbb-tw.net/phpbb/viewtopic.php?t=34466

發表於 : 2006-02-01 18:25
yuei
心靈捕手 寫:我猜想:
如果以您原先參考的文章, 修改後, 有顯示出 topic_title 的話,
那麼應該也不難顯示出 forum_id 吧!

建議您:
參考這個討論串:
http://phpbb-tw.net/phpbb/viewtopic.php?t=34466
成功了!!
謝謝心靈捕手大指教!!! ;-)