參考連結: http://phpbb-tw.net/phpbb/viewtopic.php ... light=top5
使用版本: 2.0.10
狀況描述:
因為不想訪客看到Top 5
就試在index_body.tpl 加入\r
代碼: 選擇全部
<!-- BEGIN switch_user_logged_in -->
<!-- END switch_user_logged_in -->希望各位可以幫一下手>"<
版主: 版主管理群

代碼: 選擇全部
<!-- BEGIN switch_user_logged_in -->
<!-- END switch_user_logged_in -->代碼: 選擇全部
<!-- BEGIN switch_top5_allowed -->
{TOP5}
<!-- END switch_top5_allowed -->

代碼: 選擇全部
<!-- BEGIN switch_top5_allowed -->
<!-- END switch_top5_allowed -->代碼: 選擇全部
##############################################################
## Mod Title: Top5 MOD
## Mod Version: 1.1.2
## Author: OOHOO < webdev@phpbb-tw.net > http://phpbb-tw.net/
##
## Description: Display the Last5/Top5/Hot5 topics.
##
##
## Installation Level: (easy)
## Installation Time: 1-5 Minutes
## Files To Edit: viewtopic.php, /templates/your_template/viewtopic_body.tpl,
## /language/your_lang/lang_main.php, templates/your_template/your_template.cfg
## Included Files: quick_reply.gif
##############################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
#################################################################
##
## Author Note:
##
##############################################################
## Version History:
## 2.1.0 for phpBB 2.0.0 and gzip function include
## 2.0.0 for phpBB 2 RC serial
## 1.x.x for phpBB 2 Beta serial
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

神川建議的是用OOHOO版本...momoC 寫:so ga?
這麼說吧:請到你資料庫的根目錄中找到 config.php 這程式,然後把它打開看看有沒有這行?
如果你的不是phpbb_而是其他的前置碼,我們再來討論。代碼: 選擇全部
$table_prefix = 'phpbb_';
又,你有試試用神川建議的方法嗎?
代碼: 選擇全部
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//
// Find which forums are visible for this user
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$auth_forum_ary = array();
// Get forum info
$sql = "SELECT forum_id FROM " . FORUMS_TABLE;
if( !$q_forums = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD ERROR!!');
}
// Authorized forums info
while( $forum_row = $db->sql_fetchrow($q_forums) )
{
$forum_id = $forum_row['forum_id'];
if( $is_auth_ary[$forum_id]['auth_read'] == 1)
{
array_push($auth_forum_ary, $forum_id);
}
}
if( sizeOf($auth_forum_ary) == 0 || !$AUTH_SECRUITY )
{
$auth_forums = "";
}
else
{
$auth_forums = 'AND f.forum_id IN(';
if(sizeOf($auth_forum_ary) > 1)
{
$auth_forums .= implode (',', $auth_forum_ary);
}
else
{
$auth_forums .= $auth_forum_ary[0];
}
$auth_forums .= ')';
}

再痳煩一下....應加在那lllll蕭遙 寫:OOHOO的top5裏檢查用戶觀看的語法:
厄,沒經大大的同意就貼出來了部分,不要緊吧……代碼: 選擇全部
// // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); // // End session management // // Find which forums are visible for this user $is_auth_ary = array(); $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); $auth_forum_ary = array(); // Get forum info $sql = "SELECT forum_id FROM " . FORUMS_TABLE; if( !$q_forums = $db->sql_query($sql) ) { message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD ERROR!!'); } // Authorized forums info while( $forum_row = $db->sql_fetchrow($q_forums) ) { $forum_id = $forum_row['forum_id']; if( $is_auth_ary[$forum_id]['auth_read'] == 1) { array_push($auth_forum_ary, $forum_id); } } if( sizeOf($auth_forum_ary) == 0 || !$AUTH_SECRUITY ) { $auth_forums = ""; } else { $auth_forums = 'AND f.forum_id IN('; if(sizeOf($auth_forum_ary) > 1) { $auth_forums .= implode (',', $auth_forum_ary); } else { $auth_forums .= $auth_forum_ary[0]; } $auth_forums .= ')'; }

加入後...出現\r蕭遙 寫:嘗試加在index.php裏,加入bu的整合式TOP5代碼段的這下面吧:
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
代碼: 選擇全部
Parse error: parse error, unexpected T_ELSE in /home/forum/index.php on line 709代碼: 選擇全部
}
}
} // for ... categories
}// if ... total_categories
else
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);