Integrated Topiclist 2.0 beta

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

版主: 版主管理群譯文組

版面規則
請注意!您的提問必須遵守發問格式,違者砍文。
主題已鎖定
bu
版面管理員
版面管理員
文章: 443
註冊時間: 2003-02-23 12:46
來自: 25° 4′N 121° 29′E
聯繫:

Integrated Topiclist 2.0 beta

文章 bu »

這是一個TOP5 外掛,相信phpBB 2.0.x 時代有裝過的人不陌生

可以看
MODX檔
IT2.rar
(2.34 KiB) 已下載 1069 次
或是

依照以下的step安裝:

打開

代碼: 選擇全部

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
//
然後請打開

代碼: 選擇全部

styles/subsilver2/template/index_body.html
找到

代碼: 選擇全部

<!-- INCLUDE overall_footer.html -->
在其前加上

代碼: 選擇全部

<!-- MOD: Integrated Topiclist 2.0 START -->
	<br clear="all" />
	
	<table class="tablebg" width="100%" cellspacing="1">
		<tr>
			<th width="20%">&nbsp;{L_FORUM}&nbsp;</th>
			<th width="30%">&nbsp;{L_TOPICS}&nbsp;</th>
			<th width="20%">&nbsp;{L_AUTHOR}&nbsp;</th>
			<th width="5%">&nbsp;{L_REPLIES}&nbsp;</th>
			<th width="5%">&nbsp;{L_VIEWS}&nbsp;</th>
			<th width="20%">&nbsp;{L_LAST_POST}&nbsp;</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>
<!-- MOD: Integrated Topiclist 2.0 END -->
備註:
程式(於index.php)之

// Topics text length
$MAX_STR_LEN = 40; 主題名稱最長長度

// Topics to display (Default: 5)
$MAX_TOPICS = 5; 顯示主題個數

// Order by
// topic_last_post_id 發表時間(預設)
// topic_replies 回覆數
// topic_views 觀看數
$sortby="topic_last_post_id"; 依何而排? (自上方三種選來用)

//
// Option of Toplist End
//
*譯文資料在phpBB 技術文件
bu.femto-size
*和我聯絡,請寄 or Google Talk 圖檔
*作品: Intergrated Toplist & Message Can

主題已鎖定

回到「[3.0.x] 外掛問題討論」