1 頁 (共 1 頁)

[美化] PLUS 1.5.3 將相簿藝廊的隨機圖片從左方區塊改為中間區塊顯示

發表於 : 2006-09-12 16:30
chadav
將相簿藝廊的隨機圖片從左方區塊改為中間區塊顯示

為了不至於讓版面左右寬度因為相簿藝廊的隨機圖片中間區塊而改變, 建議到後台的 -> 入口頁面 -> 基本組態 -> 在入口上會顯示出來的圖片數量 <-- 設定為 3 或 4 的倍數

本人僅針對 PLUS 1.5.3 作修改測試, 使用其餘版本的 phpBB 者請自行參考比對修改!!

打開

portal.php

尋找

代碼: 選擇全部

					$template->assign_block_vars('recent_pics.recent_col', array(
						'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_showpage.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
在後面, 加入

代碼: 選擇全部

	                                        'U_PIC_LINK' => append_sid('album_showpage.' . $phpEx . '?pic_id=' . $recentrow[$j]['pic_id']),
尋找

代碼: 選擇全部

					$template->assign_block_vars('recent_pics.recent_detail', array(
						'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_showpage.$phpEx?pic_id=". $recentrow[$j]['pic_id']),

在後面, 加入

代碼: 選擇全部

	                                        'U_PIC_LINK' => append_sid('album_showpage.' . $phpEx . '?pic_id=' . $recentrow[$j]['pic_id']),

portal_body.tpl

尋找

代碼: 選擇全部

<!-- BEGIN switch_album_pic -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="thTop" height="25" nowrap="nowrap">{L_NEWEST_PICS}</th>
在前面, 加入

代碼: 選擇全部

<!-- 此段註解不執行(最新隨機圖片) 開始
再尋找

代碼: 選擇全部

<td class="row3" height="25" align="center"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]</span></td>
</tr>
</table>
<!-- END switch_album_pic -->
在後面, 加入

代碼: 選擇全部

 此段註解不執行(最新隨機圖片) 結束 // -->

再尋找

代碼: 選擇全部

<td class="row1" align="left"><p class="genmed">{WELCOME_TEXT}</p></td>
</tr>
</table>
<!-- END welcome_text -->
在後面, 加入

代碼: 選擇全部

<!-- 相簿藝廊顯示在中間的區塊 START -->
<!-- BEGIN switch_album_pic -->
<br />
<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> 
<tr> 
<th colspan="{S_COLS}">{L_NEWEST_PICS}</th> 
</tr>
<!-- END switch_album_pic -->

<!-- BEGIN no_pics --> 
<tr> 
<td class="row1" align="center" colspan="{S_COLS}" height="50"><span class="gen">{L_NO_PICS}</span></td> 
</tr> 
<!-- END no_pics --> 

<!-- BEGIN recent_pics -->
<tr> 
<!-- BEGIN recent_col --> 
<!-- <td class="row1" width="{S_COL_WIDTH1}" align="center"><a href="{recent_pics.recent_detail.U_PIC}" {TARGET_BLANK}><img src="{recent_pics.recent_detail.THUMBNAIL}" border="0" alt="{recent_pics.recent_detail.DESC}" title="{recent_pics.recent_detail.DESC}" vspace="10" width="{recent_pics.recent_detail.WIDTH}" height="{recent_pics.recent_detail.HEIGHT}" /></a></td> -->
<td class="row1" width="{S_COL_WIDTH1}" align="center"><a href="{recent_pics.recent_col.U_PIC}" {TARGET_BLANK}><img src="{recent_pics.recent_col.THUMBNAIL}" border="0" alt="{recent_pics.recent_col.DESC}" title="{recent_pics.recent_col.DESC}" vspace="10" width="{recent_pics.recent_col.WIDTH}" height="{recent_pics.recent_col.HEIGHT}" /></a></td> 
<!-- END recent_col --> 
</tr>
<tr>
<!-- BEGIN recent_detail -->
<td class="row2" width="{S_COL_WIDTH1}">
<span class="gensmall">
{L_PIC_TITLE}: <a href="{recent_pics.recent_detail.U_PIC_LINK}" {TARGET_BLANK}>{recent_pics.recent_detail.TITLE}</a><br /> 
{L_POSTER}: {recent_pics.recent_detail.POSTER}<br />
{L_POSTED}: {recent_pics.recent_detail.TIME}<br /> 
{recent_pics.recent_detail.RATING}{recent_pics.recent_detail.COMMENTS}
{L_VIEW}: {recent_pics.recent_detail.VIEW}
</span> 
</td>
<!-- END recent_detail -->
</tr>
<!-- END recent_pics -->

<!-- BEGIN switch_album_pic -->
<tr> 
<td class="row3" colspan="{S_COLS}" align="center"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]</span></td> 
</tr> 
</table>
<br />
<!-- END switch_album_pic -->
<!-- 相簿藝廊顯示在中間的區塊 END -->
存檔 OK

發表於 : 2006-09-12 22:22
bibo8045
請教chadav兄
我目前只有在portal_body.tpl這部分自己修改(土法煉鋼慢慢自己改好了),但是從未更動到portal.php這部份,請問有差別嗎?
portal.php所更動的主要用途是....??

發表於 : 2006-09-12 22:35
chadav
bibo8045 寫:請教chadav兄
我目前只有在portal_body.tpl這部分自己修改(土法煉鋼慢慢自己改好了),但是從未更動到portal.php這部份,請問有差別嗎?
portal.php所更動的主要用途是....??
修改 portal.php 這樣才在能點圖片名稱時連到正確的路徑網頁, 然後滑鼠移到圖片時可以預覽該圖的圖片說明(若沒有就不顯示)!!

發表於 : 2006-10-05 17:56
laugh
請問一下如果我是要把文章放到中間來

請問是要變動什麼??謝謝

發表於 : 2006-10-06 03:07
hanson.hung
laugh 寫:請問一下如果我是要把文章放到中間來

請問是要變動什麼??謝謝
您可以參考這兩個Hack:
1.Top Topics on Index
2.Integrated Toplist 1.0.3
不一定要去搬原本的哦........... :-D
亦可以參考這兩個Hack的程式碼去修改原本的"最新主題"來顯示您想要顯示的資訊.

發表於 : 2006-10-06 07:47
jwxinst
@@會有demo嗎
XD方便以後修改....先謝囉...很好的教學

發表於 : 2006-10-07 03:33
hanson.hung
jwxinst 寫:@@會有demo嗎
XD方便以後修改....先謝囉...很好的教學
如圖:請點我看圖
中間上面為Top Topics on Index
中間下面為Integrated Toplist

發表於 : 2006-11-24 17:04
chadav
我來整理一下順便發表好了, 有需要的請按照以下修改步驟作

Top Topics on Index 部份:

代碼: 選擇全部

#
#-----[ OPEN ]------------------------------------------
#
portal.php

#
#-----[ FIND ]------------------------------------------
#

// 
// Start Top Posters hack 
if ( $CFG['number_top_posters'] > 0 )
{
	$sql = "SELECT post_id FROM " . POSTS_TABLE . " ORDER BY post_id DESC LIMIT 1"; 
	$result = $db->sql_query($sql); 
	$row = $db->sql_fetchrow($result); 
	$db->sql_freeresult($result);
	$total_post_perc = $row['post_id']; 
	$perc_mult = 3; 
	$perc_mult_set = 0; 
	$rank = 0; 
	$sql = "SELECT user_id, username, user_posts FROM " . USERS_TABLE ." WHERE user_id <> -1 ORDER BY user_posts DESC LIMIT ".$CFG['number_top_posters']; 
	$result = $db->sql_query($sql); 
	while( $row = $db->sql_fetchrow($result)) { 
	   $rank++; 
	   $class = (!($rank % 2)) ? 'row2' : 'row1'; 
	   $percentage = (get_db_stat('postcount') != 0) ? round(100 * $row['user_posts'] / get_db_stat('postcount'),0) : 0; 
	   $bar_perc = round($percentage * $perc_mult,0); 
	   $template->assign_block_vars("users", array( 
		  'RANK' => $rank, 
		  'CLASS' => $class, 
		  'USERNAME' => color_group_colorize_name($row['user_id']),
		  'PERCENTAGE' => $percentage, 
		  'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'], 
		  'BAR' => $bar_perc, 
		  'POSTS' => $row['user_posts']) 
	   ); 
	} 
	$db->sql_freeresult($result);
	$template->assign_block_vars('switch_top_posters', array());
}
// End Top 5 Posters hack 
//


#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------
// Top Topics on Index 1.1.0 - Begin Code Addition
//
	$template->assign_vars(array(
		'L_TOPICSRECENT' => $lang['TopicsRecent'],
		'L_TOPICSPOPULAR' => $lang['TopicsPopular'],
		'L_TOPICSPOPULARVIEW' => $lang['TopicsPopularView'])
	);

	// Get forum auth information to insure privacy of hidden topics
	$topics_auth = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);
	$topics_auth_sql = '';
	foreach($topics_auth as $k=>$v)
	{
		if( $v['auth_view'] && $v['auth_read'] )
		{
			$topics_auth_sql .= (( empty($topics_auth_sql) ) ? '': ', ') . $k;
		}
	}

	if( empty($topics_auth_sql) )
	{
		$template->assign_block_vars('topicrecentpopular', array(
			'TOPICSPOPULAR' => $lang['No_Posts'],
			'TOPICSPOPULARVIEW' => $lang['No_Posts'],
			'TOPICSRECENT' => $lang['No_Posts']
		));
	}
	else
	{
		//
		// Okay, let's build the topic recent and popular
		//
		$active_topics_sql = 'SELECT t.topic_id, t.topic_title, t.topic_replies, t.topic_views, t.topic_last_post_id
			FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE. ' f
			WHERE t.forum_id IN (' . $topics_auth_sql . ')
				AND f.forum_id = t.forum_id
			ORDER BY %1$s DESC
			LIMIT 0,5';
		$active_topics_sql_a = sprintf($active_topics_sql, 'topic_last_post_id');
		$active_topics_sql_b = sprintf($active_topics_sql, 'topic_replies');
		$active_topics_sql_c = sprintf($active_topics_sql, 'topic_views');
		$recent_row = $popular_row = $viewed_row = array();

		if( !$active_topics_a = $db->sql_query($active_topics_sql_a))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve recent topics', '', __LINE__, __FILE__, $active_topics_sql_a);
		}
		$recent_row = $db->sql_fetchrowset($active_topics_a);
		$db->sql_freeresult($active_topics_a);

		if( !$active_topics_b = $db->sql_query($active_topics_sql_b))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve popular topics', '', __LINE__, __FILE__, $active_topics_sql_b);
		}
		$popular_row = $db->sql_fetchrowset($active_topics_b);
		$db->sql_freeresult($active_topics_b);

		if( !$active_topics_c = $db->sql_query($active_topics_sql_c))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve most viewed topics', '', __LINE__, __FILE__, $active_topics_sql_c);
		}
		$viewed_row = $db->sql_fetchrowset($active_topics_c);
		$db->sql_freeresult($active_topics_c);

		for( $i = 0; $i < 5; $i++ )
		{
			$recent_topic_title = $recent_row[$i]['topic_title'];
			$popular_topic_title = $popular_row[$i]['topic_title'];
			$viewed_topic_title = $viewed_row[$i]['topic_title'];

			if( strlen($recent_topic_title) > 40 )
			{
				$recent_topic_title = substr($recent_topic_title, 0, 40) . '...';
			}

			if( strlen($popular_topic_title) > 40 )
			{
				$popular_topic_title = substr($popular_topic_title, 0, 40) . '...';
			}

			if( strlen($viewed_topic_title) > 40 )
			{
				$viewed_topic_title = substr($viewed_topic_title, 0, 40) . '...';
			}

			$recent_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $recent_row[$i]['topic_id'] . '" title="' . $recent_row[$i]['topic_title'] . '">' . $recent_topic_title . '</a>';
			$popular_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $popular_row[$i]['topic_id'] . '" title="' . $popular_row[$i]['topic_title'] . '">' . $popular_topic_title . '</a>';
			$popular_total_replies = $popular_row[$i]['topic_replies'];
			$viewed_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $viewed_row[$i]['topic_id'] . '" title="' . $viewed_row[$i]['topic_title'] . '">' . $viewed_topic_title . '</a>';
			$viewed_total_replies = $viewed_row[$i]['topic_views'];

			$template->assign_block_vars('topicrecentpopular', array(
				'TOPICSPOPULAR' => $popular_post,
				'TOPICSPOPULARC' => $popular_total_replies,
				'TOPICSPOPULARVIEW' => $viewed_post,
				'TOPICSPOPULARVIEWC' => $viewed_total_replies,
				'TOPICSRECENT' => $recent_post)
			);
		}
	}
//
// Top Topics on Index 1.1.0 - End Code Addition
//------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
templates/fisubSilver/portal_body.tpl


#
#-----[ FIND ]------------------------------------------
#

<!-- BEGIN news_categories -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- Top Topics on Index 1.1.0 - Begin Code Addition -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr> 
	<th width="25%" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSRECENT}&nbsp;</th>
	<th width="38%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULAR}&nbsp;</th>
	<th width="37%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULARVIEW}&nbsp;</th>
  </tr>
  <!-- BEGIN topicrecentpopular -->
  <tr> 
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSRECENT}</span></td>
	<td width="31%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULAR}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARC}</span></td>
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEW}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEWC}</span></td>
  </tr>
  <!-- END topicrecentpopular -->
</table>
<br />
<!-- Top Topics on Index 1.1.0 - End Code Addition -->


#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php


#
#-----[ FIND ]------------------------------------------
#

//
// That's all, Folks!
// -------------------------------------------------


#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------
// Top Topics on Index 1.1.0 - Begin Code Addition
//
$lang['TopicsRecent'] = "Recent Topics";
$lang['TopicsPopular'] = "Popular Topics (by reply)";
$lang['TopicsPopularView'] = "Popular Topics (by view)";
//
// Top Topics on Index 1.1.0 - End Code Addition
//------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

//
// That's all, Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------
// Top Topics on Index 1.1.0 - Begin Code Addition
//
$lang['TopicsRecent'] = "最新文章";
$lang['TopicsPopular'] = "最多回覆文章";
$lang['TopicsPopularView'] = "最多觀看文章";
//
// Top Topics on Index 1.1.0 - End Code Addition
//------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#

	//
	// Okay, let's build the index
	//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------
// Top Topics on Index 1.1.0 - Begin Code Addition
//
	$template->assign_vars(array(
		'L_TOPICSRECENT' => $lang['TopicsRecent'],
		'L_TOPICSPOPULAR' => $lang['TopicsPopular'],
		'L_TOPICSPOPULARVIEW' => $lang['TopicsPopularView'])
	);

	// Get forum auth information to insure privacy of hidden topics
	$topics_auth = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);
	$topics_auth_sql = '';
	foreach($topics_auth as $k=>$v)
	{
		if( $v['auth_view'] && $v['auth_read'] )
		{
			$topics_auth_sql .= (( empty($topics_auth_sql) ) ? '': ', ') . $k;
		}
	}

	if( empty($topics_auth_sql) )
	{
		$template->assign_block_vars('topicrecentpopular', array(
			'TOPICSPOPULAR' => $lang['No_Posts'],
			'TOPICSPOPULARVIEW' => $lang['No_Posts'],
			'TOPICSRECENT' => $lang['No_Posts']
		));
	}
	else
	{
		//
		// Okay, let's build the topic recent and popular
		//
		$active_topics_sql = 'SELECT t.topic_id, t.topic_title, t.topic_replies, t.topic_views, t.topic_last_post_id
			FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE. ' f
			WHERE t.forum_id IN (' . $topics_auth_sql . ')
				AND f.forum_id = t.forum_id
			ORDER BY %1$s DESC
			LIMIT 0,5';
		$active_topics_sql_a = sprintf($active_topics_sql, 'topic_last_post_id');
		$active_topics_sql_b = sprintf($active_topics_sql, 'topic_replies');
		$active_topics_sql_c = sprintf($active_topics_sql, 'topic_views');
		$recent_row = $popular_row = $viewed_row = array();

		if( !$active_topics_a = $db->sql_query($active_topics_sql_a))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve recent topics', '', __LINE__, __FILE__, $active_topics_sql_a);
		}
		$recent_row = $db->sql_fetchrowset($active_topics_a);
		$db->sql_freeresult($active_topics_a);

		if( !$active_topics_b = $db->sql_query($active_topics_sql_b))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve popular topics', '', __LINE__, __FILE__, $active_topics_sql_b);
		}
		$popular_row = $db->sql_fetchrowset($active_topics_b);
		$db->sql_freeresult($active_topics_b);

		if( !$active_topics_c = $db->sql_query($active_topics_sql_c))
		{
			message_die(GENERAL_ERROR, 'Could not retrieve most viewed topics', '', __LINE__, __FILE__, $active_topics_sql_c);
		}
		$viewed_row = $db->sql_fetchrowset($active_topics_c);
		$db->sql_freeresult($active_topics_c);

		for( $i = 0; $i < 5; $i++ )
		{
			$recent_topic_title = $recent_row[$i]['topic_title'];
			$popular_topic_title = $popular_row[$i]['topic_title'];
			$viewed_topic_title = $viewed_row[$i]['topic_title'];

			if( strlen($recent_topic_title) > 40 )
			{
				$recent_topic_title = substr($recent_topic_title, 0, 40) . '...';
			}

			if( strlen($popular_topic_title) > 40 )
			{
				$popular_topic_title = substr($popular_topic_title, 0, 40) . '...';
			}

			if( strlen($viewed_topic_title) > 40 )
			{
				$viewed_topic_title = substr($viewed_topic_title, 0, 40) . '...';
			}

			$recent_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $recent_row[$i]['topic_id'] . '" title="' . $recent_row[$i]['topic_title'] . '">' . $recent_topic_title . '</a>';
			$popular_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $popular_row[$i]['topic_id'] . '" title="' . $popular_row[$i]['topic_title'] . '">' . $popular_topic_title . '</a>';
			$popular_total_replies = $popular_row[$i]['topic_replies'];
			$viewed_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $viewed_row[$i]['topic_id'] . '" title="' . $viewed_row[$i]['topic_title'] . '">' . $viewed_topic_title . '</a>';
			$viewed_total_replies = $viewed_row[$i]['topic_views'];

			$template->assign_block_vars('topicrecentpopular', array(
				'TOPICSPOPULAR' => $popular_post,
				'TOPICSPOPULARC' => $popular_total_replies,
				'TOPICSPOPULARVIEW' => $viewed_post,
				'TOPICSPOPULARVIEWC' => $viewed_total_replies,
				'TOPICSRECENT' => $recent_post)
			);
		}
	}
//
// Top Topics on Index 1.1.0 - End Code Addition
//------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
templates/fisubSilver/index_box.tpl


#
#-----[ FIND ]------------------------------------------
#

<!-- BEGIN catrow -->
<!-- BEGIN tablehead -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">


#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- Top Topics on Index 1.1.0 - Begin Code Addition -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr> 
	<th width="25%" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSRECENT}&nbsp;</th>
	<th width="38%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULAR}&nbsp;</th>
	<th width="37%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULARVIEW}&nbsp;</th>
  </tr>
  <!-- BEGIN topicrecentpopular -->
  <tr> 
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSRECENT}</span></td>
	<td width="31%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULAR}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARC}</span></td>
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEW}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEWC}</span></td>
  </tr>
  <!-- END topicrecentpopular -->
</table>
<br />
<!-- Top Topics on Index 1.1.0 - End Code Addition -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# End

Integrated Toplist 部份:

代碼: 選擇全部

# 
#-----[ OPEN ]------------------------------------------ 
# 

portal.php

# 
#-----[ FIND ]------------------------------------------ 
# 

$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// 
// Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119)
// 
// This work is licensed under the Creative Commons Attribution-ShareAlike License. 
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ 
// 
// MOD START 

	//
	// Option of Toplist Start
	//

		// Topics text length 
		$MAX_STR_LEN = 60; 
			 
		// Topics to display (Default: 5)
		$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 
		$AUTH_SECRUITY = 1; 

		// 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; 
	} 

	// Find which forums are visible for this user 
	$is_auth_ary_top5 = array(); 
	$is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); 

	$auth_forum_ary_top5 = array(); 

	// Get forum info 
	$sql = "SELECT forum_id FROM " . FORUMS_TABLE; 

	if( !$q_forums = $db->sql_query($sql) ) 
	{ 
		message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch forum info fail', __LINE__, __FILE__, $sql); 
	} 

	// Authorized forums info 
	while( $forum_row = $db->sql_fetchrow($q_forums) ) 
	{ 
		$forum_id1 = $forum_row['forum_id']; 

		if( $is_auth_ary_top5[$forum_id1]['auth_read'] == 1) 
		{ 
			if(function_exists("array_push"))
			{
				array_push($auth_forum_ary_top5, $forum_id1); 
			} else {
				$auth_id=count($auth_forum_ary_top5);
				$auth_forum_ary_top5[$auth_id]=$forum_id1;
			}
		} 
	} 

	if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY ) 
	{ 
		$auth_forums_top5 = ""; 
	} 
	else 
	{ 
		$auth_forums_top5 = 'AND f.forum_id IN('; 

		if(sizeOf($auth_forum_ary_top5) > 1) 
		{ 
			$auth_forums_top5 .= implode (',', $auth_forum_ary_top5); 
		} 
		else 
		{ 
			$auth_forums_top5 .= $auth_forum_ary_top5[0]; 
		} 

		$auth_forums_top5 .= ')'; 
	} 

	// query 
	$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name 
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
	WHERE t.forum_id = f.forum_id 
	AND topic_moved_id = '0' 
	$auth_forums_top5 
	ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS"; 

	if( !$result = $db->sql_query($sql) ) 
	{ 
		message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic info fail', __LINE__, __FILE__, $sql); 
	} 

	// fetch rows 
	while( $rows = $db->sql_fetchrow($result) ) 
	{ 
		$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']); 
		$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']); 

		$topic_poster = $rows['topic_poster']; 
		$topic_last_post_id = $rows['topic_last_post_id']; 

		// Grab topic poster and last replier data 
		$sql = "SELECT post_username, user_id, username 
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . " 
		WHERE topic_id = '" . $rows['topic_id'] . "' 
		AND poster_id = user_id 
		ORDER BY post_id LIMIT 0, 1"; 

		if( !$p_result = $db->sql_query($sql) ) 
		{ 
			message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic poster fail', __LINE__, __FILE__, $sql); 
		} 

		$p_row = $db->sql_fetchrow($p_result); 

		$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']); 
		$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name; 

		$sql = "SELECT post_username, user_id, username, post_time 
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . " 
		WHERE post_id = '$topic_last_post_id' 
		AND poster_id = user_id"; 

		if( !$r_result = $db->sql_query($sql) ) 
		{ 
			message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic last replier fail', __LINE__, __FILE__, $sql); 
		} 

		$r_row = $db->sql_fetchrow($r_result); 

		$replier_id = $r_row['user_id']; 
		$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']); 
		$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name; 

		$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id"); 

		$template->assign_block_vars("toprow", array( 
			'FORUM_NAME' => $rows['forum_name'], 
			'FORUM_URL' => $forum_url, 
			'TOPIC' => cutStr($rows['topic_title']), 
			'TOPIC_URL' => $topic_url, 
			'TOPIC_VIEWS' => $rows['topic_views'], 
			'TOPIC_REPLIES' => $rows['topic_replies'], 
			'POST_TIME' => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']), 
			'POSTER_URL' => $poster_url, 
			'REPLIER_URL' => $replier_url, 
			'LAST_POST_URL' => $last_post_url 
		)); 
	} 

// MOD END 
// 
// Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119) 
// 

# 
#-----[ FIND ]------------------------------------------ 
# 

	'L_POSTER' => $lang['Poster'],
	'L_POSTED' => $lang['Posted'],
	// End add - Photo Album Block

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	'ICON_URL' => $images['icon_latest_reply'],
	'ICON_ALT' => $lang['View_latest_post'],
	'L_AUTHOR' => $lang['Author'], 
        'L_LASTPOST' => $lang['Last_Post'],

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/fisubSilver/portal_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 

<!-- BEGIN news_categories -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>


# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

<table width="100%" border="0" cellpadding="2" cellspacing="1" class="forumline">
	<tr> 
	  <!--<th align="center" class="thCornerL" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>-->
	  <th align="center" class="thTop" nowrap="nowrap">&nbsp;TOP5 {L_TOPICS}&nbsp;</th>
	  <th align="center" class="thTop" nowrap>&nbsp;&nbsp;{L_AUTHOR}&nbsp;&nbsp;</th>
	  <th align="center" class="thTop" nowrap">&nbsp;{L_REPLIES}&nbsp;</th>
	  <th align="center" class="thTop" nowrap>&nbsp;{L_VIEWS}&nbsp;</th>
	  <th align="center" class="thCornerR" nowrap>&nbsp;{L_LASTPOST}&nbsp;</th>
	</tr>
 <!-- BEGIN toprow -->
 <tr>
 <!--<td class="row1" nowrap><span class="gensmall"><a href="{toprow.FORUM_URL}" target="_top">{toprow.FORUM_NAME}</a></span></td>-->
 <td class="row2" nowrap><span class="gensmall"><a href="{toprow.TOPIC_URL}" target="_top">{toprow.TOPIC}</a></span></td>
 <td class="row1" align="center" nowrap><span class="gensmall">{toprow.POSTER_URL}</span></td>
 <td class="row2" align="center" nowrap><span class="gensmall">{toprow.TOPIC_REPLIES}</span></td>
 <td class="row1" align="center" nowrap><span class="gensmall">{toprow.TOPIC_VIEWS}</span></td>
 <td class="row2" align="center" nowrap><span class="gensmall">{toprow.POST_TIME}<br />{toprow.REPLIER_URL}&nbsp;<a href="{toprow.LAST_POST_URL}" target="_top"><img src="{ICON_URL}" border="0" alt="{ICON_ALT}" /></a></span></td>
 </tr>
 <!-- END toprow -->
</table>
<br />

# 
#-----[ OPEN ]------------------------------------------ 
# 

index.php

# 
#-----[ FIND ]------------------------------------------ 
# 

	//
	// Okay, let's build the index
	//

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

// 
// Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119)
// 
// This work is licensed under the Creative Commons Attribution-ShareAlike License. 
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ 
// 
// MOD START 

	//
	// Option of Toplist Start
	//

		// Topics text length 
		$MAX_STR_LEN = 60; 
			 
		// Topics to display (Default: 5)
		$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 
		$AUTH_SECRUITY = 1; 

		// 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; 
	} 

	// Find which forums are visible for this user 
	$is_auth_ary_top5 = array(); 
	$is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); 

	$auth_forum_ary_top5 = array(); 

	// Get forum info 
	$sql = "SELECT forum_id FROM " . FORUMS_TABLE; 

	if( !$q_forums = $db->sql_query($sql) ) 
	{ 
		message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch forum info fail', __LINE__, __FILE__, $sql); 
	} 

	// Authorized forums info 
	while( $forum_row = $db->sql_fetchrow($q_forums) ) 
	{ 
		$forum_id1 = $forum_row['forum_id']; 

		if( $is_auth_ary_top5[$forum_id1]['auth_read'] == 1) 
		{ 
			if(function_exists("array_push"))
			{
				array_push($auth_forum_ary_top5, $forum_id1); 
			} else {
				$auth_id=count($auth_forum_ary_top5);
				$auth_forum_ary_top5[$auth_id]=$forum_id1;
			}
		} 
	} 

	if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY ) 
	{ 
		$auth_forums_top5 = ""; 
	} 
	else 
	{ 
		$auth_forums_top5 = 'AND f.forum_id IN('; 

		if(sizeOf($auth_forum_ary_top5) > 1) 
		{ 
			$auth_forums_top5 .= implode (',', $auth_forum_ary_top5); 
		} 
		else 
		{ 
			$auth_forums_top5 .= $auth_forum_ary_top5[0]; 
		} 

		$auth_forums_top5 .= ')'; 
	} 

	// query 
	$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name 
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
	WHERE t.forum_id = f.forum_id 
	AND topic_moved_id = '0' 
	$auth_forums_top5 
	ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS"; 

	if( !$result = $db->sql_query($sql) ) 
	{ 
		message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic info fail', __LINE__, __FILE__, $sql); 
	} 

	// fetch rows 
	while( $rows = $db->sql_fetchrow($result) ) 
	{ 
		$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']); 
		$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']); 

		$topic_poster = $rows['topic_poster']; 
		$topic_last_post_id = $rows['topic_last_post_id']; 

		// Grab topic poster and last replier data 
		$sql = "SELECT post_username, user_id, username 
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . " 
		WHERE topic_id = '" . $rows['topic_id'] . "' 
		AND poster_id = user_id 
		ORDER BY post_id LIMIT 0, 1"; 

		if( !$p_result = $db->sql_query($sql) ) 
		{ 
			message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic poster fail', __LINE__, __FILE__, $sql); 
		} 

		$p_row = $db->sql_fetchrow($p_result); 

		$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']); 
		$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name; 

		$sql = "SELECT post_username, user_id, username, post_time 
		FROM " . POSTS_TABLE . ", " . USERS_TABLE . " 
		WHERE post_id = '$topic_last_post_id' 
		AND poster_id = user_id"; 

		if( !$r_result = $db->sql_query($sql) ) 
		{ 
			message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic last replier fail', __LINE__, __FILE__, $sql); 
		} 

		$r_row = $db->sql_fetchrow($r_result); 

		$replier_id = $r_row['user_id']; 
		$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']); 
		$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name; 

		$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id"); 

		$template->assign_block_vars("toprow", array( 
			'FORUM_NAME' => $rows['forum_name'], 
			'FORUM_URL' => $forum_url, 
			'TOPIC' => cutStr($rows['topic_title']), 
			'TOPIC_URL' => $topic_url, 
			'TOPIC_VIEWS' => $rows['topic_views'], 
			'TOPIC_REPLIES' => $rows['topic_replies'], 
			'POST_TIME' => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']), 
			'POSTER_URL' => $poster_url, 
			'REPLIER_URL' => $replier_url, 
			'LAST_POST_URL' => $last_post_url 
		)); 
	} 

// MOD END 
// 
// Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119) 
// 

# 
#-----[ FIND ]------------------------------------------ 
# 

				'L_POSTS' => $lang['Posts'],
				'L_LASTPOST' => $lang['Last_Post'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

				'ICON_URL' => $images['icon_latest_reply'],
				'ICON_ALT' => $lang['View_latest_post'],
				'L_AUTHOR' => $lang['Author'], 

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/fisubSilver/index_box.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 

<!-- BEGIN catrow -->
<!-- BEGIN tablehead -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

<table width="100%" border="0" cellpadding="2" cellspacing="1" class="forumline">
	<tr> 
	  <!--<th align="center" class="thCornerL" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>-->
	  <th align="center" class="thTop" nowrap="nowrap">&nbsp;TOP5 {L_TOPICS}&nbsp;</th>
	  <th align="center" class="thTop" nowrap>&nbsp;&nbsp;{L_AUTHOR}&nbsp;&nbsp;</th>
	  <th align="center" class="thTop" nowrap">&nbsp;{L_REPLIES}&nbsp;</th>
	  <th align="center" class="thTop" nowrap>&nbsp;{L_VIEWS}&nbsp;</th>
	  <th align="center" class="thCornerR" nowrap>&nbsp;{L_LASTPOST}&nbsp;</th>
	</tr>
 <!-- BEGIN toprow -->
 <tr>
 <!--<td class="row1" nowrap><span class="gensmall"><a href="{toprow.FORUM_URL}" target="_top">{toprow.FORUM_NAME}</a></span></td>-->
 <td class="row2" nowrap><span class="gensmall"><a href="{toprow.TOPIC_URL}" target="_top">{toprow.TOPIC}</a></span></td>
 <td class="row1" align="center" nowrap><span class="gensmall">{toprow.POSTER_URL}</span></td>
 <td class="row2" align="center" nowrap><span class="gensmall">{toprow.TOPIC_REPLIES}</span></td>
 <td class="row1" align="center" nowrap><span class="gensmall">{toprow.TOPIC_VIEWS}</span></td>
 <td class="row2" align="center" nowrap><span class="gensmall">{toprow.POST_TIME}<br />{toprow.REPLIER_URL}&nbsp;<a href="{toprow.LAST_POST_URL}" target="_top"><img src="{ICON_URL}" border="0" alt="{ICON_ALT}" /></a></span></td>
 </tr>
 <!-- END toprow -->
</table>
<br />

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

發表於 : 2006-11-30 05:21
bibo8045
chadav 兄
小弟仍然有個老問題,Top Topics on Index這個能限制只統計某幾個分區就好嗎?
有些分區可能是聊天或是測試語法的,跟實際討論內容無關,可以做這樣的限制嗎?