[問題] 修改標題顏色 跟 至頂公告區域 外掛衝突

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

版主: 版主管理群

主題已鎖定
頭像
koras77
星球普通子民
星球普通子民
文章: 21
註冊時間: 2005-10-18 23:42
來自: 我老媽的肚子
聯繫:

[問題] 修改標題顏色 跟 至頂公告區域 外掛衝突

文章 koras77 »

phpbb版本 2.0.17

伺服器 appserv 2.4.4

修改標題顏色外掛 參考修改標題顏色

至頂公告區域 參考 Split topic type 1.0.5

小弟在安裝完後發現一個問題 置頂公告外掛會把 修改標題顏色外掛的程式碼\r

給註解掉 請問我該怎麼回復修改標題顏色功能 又可以有置頂公告外掛的功能存在呢\r

以下附上 viewforum.php 的code 部分內容

代碼: 選擇全部

// send the list
$allow_split_type = true;
$display_nav_tree = false;
topic_list('TOPICS_LIST_BOX', 'topics_list_box', $topic_rowset, '', $allow_split_type, $display_nav_tree, $footer);
//-- delete
/*
//---------------------------------------
//
// Note : all the code that was standing there stands now in functions_topics_list.php, topic_list() func
//
//---------------------------------------
// Added by Attached Forums MOD

if ($attachments)
{

		//
		// Obtain a list of topic ids which contain
		// posts made since user last visited
		//
		if ( $userdata['session_logged_in'] )
		{
			$sql = "SELECT t.forum_id, t.topic_id, p.post_time
				FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
				WHERE p.post_id = t.topic_last_post_id
					AND p.post_time > " . $userdata['user_lastvisit'] . "
					AND t.topic_moved_id = 0";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
			}

			$new_topic_data = array();\r
			while( $topic_data = $db->sql_fetchrow($result) )
			{
				$new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
			}
		}

		$sql2 = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
			FROM ((( " . FORUMS_TABLE . " f
			LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
			LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
			LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = f.forum_last_post_id)
			WHERE attached_forum_id = " . $forum_id . "
			GROUP by f.forum_id ORDER BY f.forum_order";

		$result2 = $db->sql_query ($sql2);
		if (!$result2 )
		{
			message_die ('Could not gather attached forum info', __LINE__, __FILE__, $sql2);
		}

		if ($db->sql_numrows ($result2) != 0)
		{
			while( $row = $db->sql_fetchrow($result2) )
			{
				$forum_data[] = $row;
			}
			$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

			$x=0;
			foreach ($forum_data as $row2 => $value)
			{
				if ($is_auth_ary[$value['forum_id']]['auth_view'])
				{
					$x++;
					if ($x==1)
					{
						$template->assign_block_vars ('switch_attached_list',
								   array( 'L_ATTACHED_FORUM' => $lang['Attached_forums'],
										 'L_ATTACHED_TOPICS' => $lang['Topics'],
										 'L_ATTACHED_POSTS' => $lang['Posts'],
										 'L_LAST_POST'=>$lang['Last_Post']
									   )
									);

					}
					$attach_forum_link = append_sid('viewforum.php?f=' . $value['forum_id']);
					$attach_forum_name = '<a href="' . append_sid('viewforum.php?f=' . $value['forum_id']) . '">' . $value['forum_name'] . '</a>' ;
					$attach_forum_desc = $value['forum_desc'];
					$attach_forum_topics = $value['forum_topics'];
					$attach_forum_posts = $value['forum_posts'];
					$last_post_id = $value['forum_last_post_id'];

   					if ( $value['forum_status'] == FORUM_LOCKED )
					{
						$folder_image = $images['forum_locked'];
						$folder_alt = $lang['Forum_locked'];
					}
					else
					{
						$unread_topics = false;
						if ( $userdata['session_logged_in'] )
						{
							$unread_topics=check_unread($value['forum_id']);
						}

						$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
						$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
					}

					if ( $value['forum_last_post_id'] )
					{

						if (strlen($value['topic_title'])>=25)
						{
							$value['topic_title']=substr($value['topic_title'],0,25). "...";
						}

						$last_post_time = create_date($board_config['default_dateformat'], $value['post_time'], $board_config['board_timezone']);
						$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $value['forum_last_post_id']) . '#' . $value['forum_last_post_id'] . '">'.$value['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

						$last_post .= '<br /> '; 
						$last_post .= ' '.$last_post_time;	
						$last_post .= '<br /> '; 
						$last_post .= ( $value['user_id'] == ANONYMOUS ) ? ( ($value['post_username'] != '' ) ? $value['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $value['user_id']) . '">' . $value['username'] . '</a> ';
													


					}
					else
					{
						$last_post = $lang['No_Posts'];
					}




				 $template->assign_block_vars ('switch_attached_list.switch_attached_present',
										 array
										 (
											'FORUM_FOLDER_IMG' => $folder_image,
											'L_FORUM_FOLDER_ALT' => $folder_alt,
											'FORUM_NAME' => $attach_forum_name,
											'U_VIEWFORUM' => $attach_forum_link,
											'FORUM_DESC' => $attach_forum_desc,
											'TOPICS' => $attach_forum_topics,
											'POSTS' => $attach_forum_posts,
											'LAST_POST_ID' => $last_post,
										 ));
				}
		}

	}
	   $db->sql_freeresult ($result2);
}
   // END Added by Attached Forums MOD
if( $total_topics )
{
	for($i = 0; $i < $total_topics; $i++)
	{
		$topic_id = $topic_rowset[$i]['topic_id'];

		$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
    if ( $topic_rowset[$i]['topic_color'] )
		{
		$topic_color = '#'.$topic_rowset[$i]['topic_color'];
		}
		else
		{
		$topic_color = '';
		}
		
		$topic_title = "<font color = '" . $topic_color . "'>" . $topic_title . "</color>";

		if ( $userdata['user_level'] == MOD | $userdata['user_level'] == ADMIN )
		{
		$u_topic_color = append_sid("topiccolor.$phpEx?id=".$topic_id);
		$a_topic_color = "<a href=" . $u_topic_color . ">(C)</a>";
		}
		else
		{
		$u_topic_color = '';
		$a_topic_color = '';
		}

		$replies = $topic_rowset[$i]['topic_replies'];

		$topic_type = $topic_rowset[$i]['topic_type'];

		if( $topic_type == POST_ANNOUNCE )
		{
			$topic_type = $lang['Topic_Announcement'] . ' ';
		}
		else if( $topic_type == POST_STICKY )
		{
			$topic_type = $lang['Topic_Sticky'] . ' ';
		}
		else
		{
			$topic_type = '';		
		}

		if( $topic_rowset[$i]['topic_vote'] )
		{
			$topic_type .= $lang['Topic_Poll'] . ' ';
		}
		
		if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
		{
			$topic_type = $lang['Topic_Moved'] . ' ';
			$topic_id = $topic_rowset[$i]['topic_moved_id'];

			$folder_image =  $images['folder'];
			$folder_alt = $lang['Topics_Moved'];
			$newest_post_img = '';
		}
		else
		{
			if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
			{
				$folder = $images['folder_announce'];
				$folder_new = $images['folder_announce_new'];
			}
			else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
			{
				$folder = $images['folder_sticky'];
				$folder_new = $images['folder_sticky_new'];
			}
			else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
			{
				$folder = $images['folder_locked'];
				$folder_new = $images['folder_locked_new'];
			}
			else
			{
				if($replies >= $board_config['hot_threshold'])
				{
					$folder = $images['folder_hot'];
					$folder_new = $images['folder_hot_new'];
				}
				else
				{
					$folder = $images['folder'];
					$folder_new = $images['folder_new'];
				}
			}

			$newest_post_img = '';
			if( $userdata['session_logged_in'] )
			{
				if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) 
				{
					if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
					{
						$unread_topics = true;

						if( !empty($tracking_topics[$topic_id]) )
						{
							if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}

						if( !empty($tracking_forums[$forum_id]) )
						{
							if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}

						if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
						{
							if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}

						if( $unread_topics )
						{
							$folder_image = $folder_new;
							$folder_alt = $lang['New_posts'];

							$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
						}
						else
						{
							$folder_image = $folder;
							$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

							$newest_post_img = '';
						}
					}
					else
					{
						$folder_image = $folder_new;
						$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];

						$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
					}
				}
				else 
				{
					$folder_image = $folder;
					$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

					$newest_post_img = '';
				}
			}
			else
			{
				$folder_image = $folder;
				$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

				$newest_post_img = '';
			}
		}

		if( ( $replies + 1 ) > $board_config['posts_per_page'] )
		{
			$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
			$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';

			$times = 1;
			for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
			{
				$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
				if( $times == 1 && $total_pages > 4 )
				{
					$goto_page .= ' ... ';
					$times = $total_pages - 3;
					$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
				}
				else if ( $times < $total_pages )
				{
					$goto_page .= ', ';
				}
				$times++;
			}
			$goto_page .= ' ] ';
		}
		else
		{
			$goto_page = '';
		}
		
		$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");

		$topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
		$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );

		$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';

		$first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']);

		$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

		$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';

		$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';

		$views = $topic_rowset[$i]['topic_views'];
		
		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

		$template->assign_block_vars('topicrow', array(
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'FORUM_ID' => $forum_id,
			'TOPIC_ID' => $topic_id,
			'TOPIC_FOLDER_IMG' => $folder_image, 
			'TOPIC_AUTHOR' => $topic_author, 
			'GOTO_PAGE' => $goto_page,
			'REPLIES' => $replies,
			'NEWEST_POST_IMG' => $newest_post_img, 
			'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']),
			'TOPIC_TITLE' => $topic_title,
			'TOPIC_TYPE' => $topic_type,
			'VIEWS' => $views,
			'FIRST_POST_TIME' => $first_post_time, 
			'LAST_POST_TIME' => $last_post_time, 
			'LAST_POST_AUTHOR' => $last_post_author, 
			'LAST_POST_IMG' => $last_post_url, 

			'L_TOPIC_FOLDER_ALT' => $folder_alt, 
			'U_TOPIC_COLOR' => $u_topic_color,
			'A_TOPIC_COLOR' => $a_topic_color,

			'U_VIEW_TOPIC' => $view_topic_url)
		);
	}
*/
//-- fin mod : split topic type --------------------------------------------------------------------
	$topics_count -= $total_announcements;

	$template->assign_vars(array(
		'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
		'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), 

		'L_GOTO_PAGE' => $lang['Goto_page'])
	);
	//-- mod : split topic type ------------------------------------------------------------------------
//-- delete
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8538
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

我在測試論壇, 安裝這兩支外掛, 並無多大的衝突.
只有一個地方需要調整.

而且以您所貼的 viewforum.php 看來
似乎所安裝的並非 Split topic type 1.0.5
因為過程中並無註解這一大段? :-?

建議您:
1. 先安裝 Split topic type 1.0.5,
後安裝 修改標題顏色
2. 安裝後者的最後一個步驟, 必須修改如下:
**這是原安裝說明擷取**
#
#-----[ OPEN ]------------------------------------------
#

templates/XXX/viewforum_body.tpl (xxx stands for your template name, do this for all your templates)


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

{topicrow.GOTO_PAGE}\r

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

{topicrow.A_TOPIC_COLOR}


#
#-----[ SAVE AND UPLOAD ALL ]------------------------------------------
#
**因應 Split topic type 1.0.5 修改如下**
#
#-----[ OPEN ]------------------------------------------
#

templates/XXX/viewforum_body.tpl (xxx stands for your template name, do this for all your templates)


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

{row.topicrow.GOTO_PAGE}

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

{row.topicrow.A_TOPIC_COLOR}


#
#-----[ SAVE AND UPLOAD ALL ]------------------------------------------
#
DEMO:
http://wang5555.dnsfor.me/test/phpbb2/viewforum.php?f=2
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8538
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

To koras:

翻了一下, 我大概知道問題出在哪裡了?

您安裝的 Split topic type 應該是新版的 2.0.1

以下是該外掛關於 viewforum.php 修改的部份擷取:
#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : split topic type ------------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : split topic type ------------------------------------------------------------------------
//-- add
include_once($phpbb_root_path . 'includes/functions_topics_list.'. $phpEx);
//-- fin mod : split topic type --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Okay, lets dump out the page ...
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
#************************************************************************************
# NOTE :
# ------
# /! Important : I strongly recommand to mute all the lines between the nexts
# --------- /* and */
# by adding // in front of each lines or by deleting all.
#
# ie: // if( $total_topics )
#
#************************************************************************************
//-- mod : split topic type ------------------------------------------------------------------------
//-- add
// adjust the item id
for ($i=0; $i < count($topic_rowset); $i++)
{
$topic_rowset[$i]['topic_id'] = POST_TOPIC_URL . $topic_rowset[$i]['topic_id'];
}

// set the bottom sort option
$footer = $lang['Display_topics'] . ': ' . $select_topic_days . ' ' . ( !empty($s_display_order) ? $s_display_order : '') . '<input type="submit" class="liteoption" value="' . $lang['Go'] . '" name="submit" />';

// send the list
$allow_split_type = true;
$display_nav_tree = false;
topic_list('TOPICS_LIST_BOX', 'topics_list_box', $topic_rowset, '', $allow_split_type, $display_nav_tree, $footer);
//-- delete
/*
//---------------------------------------
//
// Note : all the code that was standing there stands now in functions_topics_list.php, topic_list() func
//
//---------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$topics_count -= $total_announcements;
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
*/
//-- fin mod : split topic type --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
}
else
{
//
// No topics
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : split topic type ------------------------------------------------------------------------
//-- delete
/
#
#-----[ FIND ]------------------------------------------------
\n#
//
// Parse the page and print
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
*/
//-- fin mod : split topic type --------------------------------------------------------------------
由於這個新版 2.0.1 的外掛, 會和許多外掛不相容;
因此建議您安裝舊版 1.0.5 即可.
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
主題已鎖定

回到「外掛問題討論」