[研究] phpbb 3.0.10 安裝TOP5模組(Integrated Topiclist 2.0 beta)
本篇是接續
本篇是接續
[研究] phpbb 3.0.10 快速安裝程式 (CentOS 6.2 x86)
http://shaurong.blogspot.com/2012/01/phpbb-3.html
[研究] phpbb 3.0.10 安裝RSS模組(simple syndication 1.1.1b)
http://shaurong.blogspot.com/2012/01/phpbb-3010-rsssimple-syndication-111b.html
Integrated Topiclist 2.0 beta下載
http://phpbb-tw.net/phpbb/viewtopic.php?f=134&t=50165
http://phpbb-tw.net/phpbb/download/file.php?id=11
IT2.rar這個模組的缺點是只支援subsilver2,不支援prosilver。所以 phpbb 需要先將風格從預設的 prosilver 切換為 subsilver2
安裝步驟如下(這個寫快速安裝程式會累死):
打開
代碼:
index.php
找到
代碼:
// Assign index specific vars
在後面加入
代碼:
//
// Integrated Topiclist v 2.0 START
//
// Topics text length
$MAX_STR_LEN = 40;
// Topics to display (Default: 5)
$MAX_TOPICS = 5;
// Order by
// topic_last_post_id (Default)
// topic_replies
// topic_views
$sortby="topic_last_post_id";
//
// Option of Toplist End
//
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$raw_auth_forums = $auth->acl_getf('f_read');
$auth_forums = array();
while(list($k,$v)=each($raw_auth_forums)) if($v['f_read'] == 1) $auth_forums[] =$k;
$auth_forums_sql = implode(',',$auth_forums);
$sql_array['SELECT'] = array('t.topic_id','t.topic_replies','t.topic_views','t.forum_id','f.forum_name','t.topic_title','t.topic_first_poster_colour','t.topic_first_poster_name','t.topic_last_poster_id','t.topic_last_post_id','t.topic_last_poster_name','t.topic_last_poster_colour','t.topic_last_post_time','t.topic_poster');
$sql_array['FROM'] = array(TOPICS_TABLE => 't',FORUMS_TABLE => 'f');
// SQL array for obtaining topics/stickies
$sql_array = array(
'SELECT' => implode(',',$sql_array['SELECT']),
'FROM' => $sql_array['FROM'],
'WHERE' => ' t.forum_id IN ('.$auth_forums_sql .') AND f.forum_id = t.forum_id',
'ORDER_BY' => 't.'.$sortby.' DESC'
);
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $MAX_TOPICS, 0);
while ($row = $db->sql_fetchrow($result))
{
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $row['topic_id']);
$template->assign_block_vars('topiclist', array(
'TOPIC_TITLE' => cutStr($row['topic_title']),
'FORUM_NAME' => $row['forum_name'],
'FORUM_ID' => $row['forum_id'],
'LAST_REPLY_TIME' => $user->format_date($row['topic_last_post_time']),
'LAST_REPLYER' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_LAST_POST_POSTER' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_TOPIC_POSTER' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'TOPIC_REPLIES' => $row['topic_replies'],
'TOPIC_VIEWS' => $row['topic_views'],
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'TOPIC_POSTER' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'FORUM_ID' => $row['forum_id'],
'FORUM_URL' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'TOPIC_URL' => $view_topic_url
)
);
}
$db->sql_freeresult($result);
//
// Integrated Topiclist V 2.0 END
//
// Integrated Topiclist v 2.0 START
//
// Topics text length
$MAX_STR_LEN = 40;
// Topics to display (Default: 5)
$MAX_TOPICS = 5;
// Order by
// topic_last_post_id (Default)
// topic_replies
// topic_views
$sortby="topic_last_post_id";
//
// Option of Toplist End
//
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$raw_auth_forums = $auth->acl_getf('f_read');
$auth_forums = array();
while(list($k,$v)=each($raw_auth_forums)) if($v['f_read'] == 1) $auth_forums[] =$k;
$auth_forums_sql = implode(',',$auth_forums);
$sql_array['SELECT'] = array('t.topic_id','t.topic_replies','t.topic_views','t.forum_id','f.forum_name','t.topic_title','t.topic_first_poster_colour','t.topic_first_poster_name','t.topic_last_poster_id','t.topic_last_post_id','t.topic_last_poster_name','t.topic_last_poster_colour','t.topic_last_post_time','t.topic_poster');
$sql_array['FROM'] = array(TOPICS_TABLE => 't',FORUMS_TABLE => 'f');
// SQL array for obtaining topics/stickies
$sql_array = array(
'SELECT' => implode(',',$sql_array['SELECT']),
'FROM' => $sql_array['FROM'],
'WHERE' => ' t.forum_id IN ('.$auth_forums_sql .') AND f.forum_id = t.forum_id',
'ORDER_BY' => 't.'.$sortby.' DESC'
);
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $MAX_TOPICS, 0);
while ($row = $db->sql_fetchrow($result))
{
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $row['topic_id']);
$template->assign_block_vars('topiclist', array(
'TOPIC_TITLE' => cutStr($row['topic_title']),
'FORUM_NAME' => $row['forum_name'],
'FORUM_ID' => $row['forum_id'],
'LAST_REPLY_TIME' => $user->format_date($row['topic_last_post_time']),
'LAST_REPLYER' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_LAST_POST_POSTER' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_TOPIC_POSTER' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'TOPIC_REPLIES' => $row['topic_replies'],
'TOPIC_VIEWS' => $row['topic_views'],
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'TOPIC_POSTER' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'FORUM_ID' => $row['forum_id'],
'FORUM_URL' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'TOPIC_URL' => $view_topic_url
)
);
}
$db->sql_freeresult($result);
//
// Integrated Topiclist V 2.0 END
//
然後請打開
代碼:
styles/subsilver2/template/index_body.html
找到
代碼:
<!-- INCLUDE overall_footer.html -->
在其前加上
(原來版本)
代碼:
<!-- MOD: Integrated Topiclist 2.0 START -->
<br clear="all" />
<br>
<table class="tablebg" width="95%" cellspacing="1">
<tr>
<th width="20%"> {L_FORUM} </th>
<th width="30%"> {L_TOPICS} </th>
<th width="20%"> {L_AUTHOR} </th>
<th width="5%"> {L_REPLIES} </th>
<th width="5%"> {L_VIEWS} </th>
<th width="20%"> {L_LAST_POST} </th>
</tr>
<!-- BEGIN topiclist -->
<tr>
<td class="row1" align="center"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
<td class="row2" align="center"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
<td class="row1" align="center"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
<td class="row2" align="center">{topiclist.TOPIC_REPLIES}</td>
<td class="row1" align="center">{topiclist.TOPIC_VIEWS}</td>
<td class="row2" align="center">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
</tr>
<!-- END topiclist -->
</table>
<br>
<!-- MOD: Integrated Topiclist 2.0 END -->
<br clear="all" />
<br>
<table class="tablebg" width="95%" cellspacing="1">
<tr>
<th width="20%"> {L_FORUM} </th>
<th width="30%"> {L_TOPICS} </th>
<th width="20%"> {L_AUTHOR} </th>
<th width="5%"> {L_REPLIES} </th>
<th width="5%"> {L_VIEWS} </th>
<th width="20%"> {L_LAST_POST} </th>
</tr>
<!-- BEGIN topiclist -->
<tr>
<td class="row1" align="center"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
<td class="row2" align="center"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
<td class="row1" align="center"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
<td class="row2" align="center">{topiclist.TOPIC_REPLIES}</td>
<td class="row1" align="center">{topiclist.TOPIC_VIEWS}</td>
<td class="row2" align="center">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
</tr>
<!-- END topiclist -->
</table>
<br>
<!-- MOD: Integrated Topiclist 2.0 END -->
(小弟的改良版本)
代碼:
<!-- MOD: Integrated Topiclist 2.0 START -->
<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th> {L_FORUM} </th>
<th> {L_TOPICS} </th>
<th> {L_AUTHOR} </th>
<th> {L_REPLIES} </th>
<th> {L_VIEWS} </th>
<th> {L_LAST_POST} </th>
</tr>
<!-- BEGIN topiclist -->
<tr>
<td class="row1" align="left"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
<td class="row2" align="left"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
<td class="row1" align="left"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
<td class="row2" align="left">{topiclist.TOPIC_REPLIES}</td>
<td class="row1" align="left">{topiclist.TOPIC_VIEWS}</td>
<td class="row2" align="left">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
</tr>
<!-- END topiclist -->
</table>
<!-- MOD: Integrated Topiclist 2.0 END -->
<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th> {L_FORUM} </th>
<th> {L_TOPICS} </th>
<th> {L_AUTHOR} </th>
<th> {L_REPLIES} </th>
<th> {L_VIEWS} </th>
<th> {L_LAST_POST} </th>
</tr>
<!-- BEGIN topiclist -->
<tr>
<td class="row1" align="left"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
<td class="row2" align="left"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
<td class="row1" align="left"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
<td class="row2" align="left">{topiclist.TOPIC_REPLIES}</td>
<td class="row1" align="left">{topiclist.TOPIC_VIEWS}</td>
<td class="row2" align="left">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
</tr>
<!-- END topiclist -->
</table>
<!-- MOD: Integrated Topiclist 2.0 END -->
index.php補充說明
代碼:
// Topics text length
$MAX_STR_LEN = 40; 主題名稱最長長度(建議改400)
// Topics to display (Default: 5)
$MAX_TOPICS = 5; 顯示主題個數 (建議改20)
// Order by
// topic_last_post_id 發表時間(預設)
// topic_replies 回覆數
// topic_views 觀看數
$sortby="topic_last_post_id"; 依何而排? (自上方三種選來用)
//
// Option of Toplist End
//
$MAX_STR_LEN = 40; 主題名稱最長長度(建議改400)
// Topics to display (Default: 5)
$MAX_TOPICS = 5; 顯示主題個數 (建議改20)
// Order by
// topic_last_post_id 發表時間(預設)
// topic_replies 回覆數
// topic_views 觀看數
$sortby="topic_last_post_id"; 依何而排? (自上方三種選來用)
//
// Option of Toplist End
//
如果畫面沒有變化,把 phpbb 根目錄下的 cache 子目錄下的檔案全砍。
若仍沒用,把
代碼:
$template->set_filenames(array(
'body' => 'index_body.html')
);
'body' => 'index_body.html')
);
改為
代碼:
$template->set_filenames(array(
'body' => 'index_body2.html')
);
'body' => 'index_body2.html')
);
./styles/subsilver2/template 目錄中
把 index_body.html 改為 index_body2.html
如果發生index_body載入過,怎麼修改都無效時,可每改一次index_body.html就換一次名稱。
(完)
沒有留言:
張貼留言