[問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

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

版主: 版主管理群

主題已鎖定
davidhuang
星球公民
星球公民
文章: 33
註冊時間: 2007-01-31 13:29

[問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 davidhuang »

想請教各位高手,
小弟想在討論區首頁(index.php)加入『最新網誌文章』列表(weblogs_news.php).

就是把 http://pspwave.eland.idv.tw/weblogs_news.php 的 "最新的網誌文章" 放到首頁去.

我有把weblogs_news.tpl的一些程式碼複製到index_body_plus.tpl內,
但是我不知道weblogs_news.php 中是否還有一些程式碼要搬到(例如SQL語法等) index.php , 還是是要改別的地方?

請各位高手幫忙, 感謝您!!!

這個問題的外掛位置 : Blog Mod (網誌) (Update 0.2.4b)
http://phpbb-tw.net/phpbb/viewtopic.php?t=35352

●架設主機作業系統:Linux (Fedoara Core 6)
●您的上網方式:Hinet ADSL 12M/1M
●您的 phpBB2 版本:phpBB 2.0.21
●您的 domain(網域名稱) :http://pspwave.eland.idv.tw
●您的 phpBB2 連結網址:http://pspwave.eland.idv.tw
Arisa520
星球公民
星球公民
文章: 206
註冊時間: 2003-10-27 00:26

文章 Arisa520 »

看到大大的發文
這邊突然有個想法
如果整合入TOP5中
好像滿有發展性的 :)
yuei
星球公民
星球公民
文章: 93
註冊時間: 2005-12-20 22:14

文章 yuei »

不難@@..

mysql叫一下就好了@@
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 心靈捕手 »

davidhuang 寫:想請教各位高手,
小弟想在討論區首頁(index.php)加入『最新網誌文章』列表(weblogs_news.php).

就是把 http://pspwave.eland.idv.tw/weblogs_news.php 的 "最新的網誌文章" 放到首頁去.

我有把weblogs_news.tpl的一些程式碼複製到index_body_plus.tpl內,
但是我不知道weblogs_news.php 中是否還有一些程式碼要搬到(例如SQL語法等) index.php , 還是是要改別的地方?

請各位高手幫忙, 感謝您!!!

這個問題的外掛位置 : Blog Mod (網誌) (Update 0.2.4b)
http://phpbb-tw.net/phpbb/viewtopic.php?t=35352

●架設主機作業系統:Linux (Fedoara Core 6)
●您的上網方式:Hinet ADSL 12M/1M
●您的 phpBB2 版本:phpBB 2.0.21
●您的 domain(網域名稱) :http://pspwave.eland.idv.tw
●您的 phpBB2 連結網址:http://pspwave.eland.idv.tw
依您的做法, 一定得將 'weblogs_news.php 一些程式碼搬到 index.php'.

或許, 您也可以考慮利用 <iframe> 語法嵌入 weblogs_news.php 將更容易.
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
davidhuang
星球公民
星球公民
文章: 33
註冊時間: 2007-01-31 13:29

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 davidhuang »

心靈捕手 寫:
davidhuang 寫:想請教各位高手,
小弟想在討論區首頁(index.php)加入『最新網誌文章』列表(weblogs_news.php).

就是把 http://pspwave.eland.idv.tw/weblogs_news.php 的 "最新的網誌文章" 放到首頁去.

我有把weblogs_news.tpl的一些程式碼複製到index_body_plus.tpl內,
但是我不知道weblogs_news.php 中是否還有一些程式碼要搬到(例如SQL語法等) index.php , 還是是要改別的地方?

請各位高手幫忙, 感謝您!!!

這個問題的外掛位置 : Blog Mod (網誌) (Update 0.2.4b)
http://phpbb-tw.net/phpbb/viewtopic.php?t=35352

●架設主機作業系統:Linux (Fedoara Core 6)
●您的上網方式:Hinet ADSL 12M/1M
●您的 phpBB2 版本:phpBB 2.0.21
●您的 domain(網域名稱) :http://pspwave.eland.idv.tw
●您的 phpBB2 連結網址:http://pspwave.eland.idv.tw
依您的做法, 一定得將 'weblogs_news.php 一些程式碼搬到 index.php'.

或許, 您也可以考慮利用 <iframe> 語法嵌入 weblogs_news.php 將更容易.
謝謝心靈兄:

其實也是有考慮過 <iframe>, 但那是萬不得已, 要知道 weblogs_news.tpl 的區塊搬到 index_body.tpl 容易, 但 weblogs_news.php 搬到 index.php 就難很多, 不只道要搬那一部份的 SQL & 相關涵式, 而且我發現還有 Smart tier 的變數衝突, 呵呵...不知道ㄝ...越有挑戰性很像越有趣...不過看 Code 看到頭花昏.... :-D

而且這一塊很有修改的價值..以經營討論區來說...會有更多人看到更新的 Blog.... :-D
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 心靈捕手 »

davidhuang 寫:
心靈捕手 寫:
davidhuang 寫:想請教各位高手,
小弟想在討論區首頁(index.php)加入『最新網誌文章』列表(weblogs_news.php).

就是把 http://pspwave.eland.idv.tw/weblogs_news.php 的 "最新的網誌文章" 放到首頁去.

我有把weblogs_news.tpl的一些程式碼複製到index_body_plus.tpl內,
但是我不知道weblogs_news.php 中是否還有一些程式碼要搬到(例如SQL語法等) index.php , 還是是要改別的地方?

請各位高手幫忙, 感謝您!!!

這個問題的外掛位置 : Blog Mod (網誌) (Update 0.2.4b)
http://phpbb-tw.net/phpbb/viewtopic.php?t=35352

●架設主機作業系統:Linux (Fedoara Core 6)
●您的上網方式:Hinet ADSL 12M/1M
●您的 phpBB2 版本:phpBB 2.0.21
●您的 domain(網域名稱) :http://pspwave.eland.idv.tw
●您的 phpBB2 連結網址:http://pspwave.eland.idv.tw
依您的做法, 一定得將 'weblogs_news.php 一些程式碼搬到 index.php'.

或許, 您也可以考慮利用 <iframe> 語法嵌入 weblogs_news.php 將更容易.
謝謝心靈兄:

其實也是有考慮過 <iframe>, 但那是萬不得已, 要知道 weblogs_news.tpl 的區塊搬到 index_body.tpl 容易, 但 weblogs_news.php 搬到 index.php 就難很多, 不只道要搬那一部份的 SQL & 相關涵式, 而且我發現還有 Smart tier 的變數衝突, 呵呵...不知道ㄝ...越有挑戰性很像越有趣...不過看 Code 看到頭花昏.... :-D

而且這一塊很有修改的價值..以經營討論區來說...會有更多人看到更新的 Blog.... :-D
個人以為, 畢竟您架設的是論壇, 而非網誌;
也就是說, 不必非得將最新的網誌文章顯示在論壇首頁.

我試過將 'weblogs_news.php 搬到 index.php' 遇到一些錯誤, 需要處理;
但是, 若是使用 <iframe>, 則較為容易.

DEMO:
http://wang5555.dnsfor.me/phpbb2/weblogs_news.php
http://wang5555.dnsfor.me/phpbb2/index.php
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 心靈捕手 »

心靈捕手 寫:我試過將 'weblogs_news.php 搬到 index.php' 遇到一些錯誤, 需要處理;
但是, 若是使用 <iframe>, 則較為容易.

DEMO:
http://wang5555.dnsfor.me/phpbb2/weblogs_news.php
http://wang5555.dnsfor.me/phpbb2/index.php
經過測試發現, 之前的觀念錯誤! :oops:
若要使用 <iframe>, 則需要處理的地方更多.

以下的修改, 提供您參考:
#
#-----[ OPEN ]-----
#
index.php

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

代碼: 選擇全部

//
// Generate the page
//
#
#-----[ BEFORE, ADD ]-----
#

代碼: 選擇全部

// + Blog News =====

//
// Get the moods data
//
$sql = "SELECT *
	FROM " . WEBLOG_MOODS_TABLE . "
	ORDER BY mood_text";
if( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, "Couldn't obtain mood data from database", "", __LINE__, __FILE__, $sql);
}
$mood_data = $db->sql_fetchrowset($result);

//
// Get the actions data
//
$sql = "SELECT *
	FROM " . WEBLOG_ACTIONS_TABLE . "
	ORDER BY action_text";
if( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, "Couldn't obtain action data from database", "", __LINE__, __FILE__, $sql);
}
$action_data = $db->sql_fetchrowset($result);

// Get the user's clearence levels
$auth_level = get_auth_level ( $weblog_data, $friends_data, $blocked_data, $weblog_data['user_id'], $contributor );

// See if user can see this weblog
if ( $weblog_data['weblog_auth'] > $auth_level )
{
	message_die(GENERAL_ERROR, $lang['Weblog_noaccess']);
}

//
// Latest Entries
//

if ( $weblog_config['show_latest_entries'] )
{
	$sql = "SELECT e.entry_id, e.entry_access, e.entry_subject, e.entry_time, e.entry_views, e.entry_poster_id, e.entry_text, e.bbcode_uid, e.entry_mood, e.entry_currently, e.currently_text, e.entry_replies, u.user_id, u.username
			FROM " . WEBLOG_ENTRIES_TABLE . " AS e, " . USERS_TABLE . " AS u
			WHERE entry_access <= $auth_level
			AND e.entry_poster_id = u.user_id
			AND e.entry_deleted <> " . TRUE . "
			ORDER BY entry_id DESC
			LIMIT " . $weblog_config['latest_entry_max'];
			if (!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not query blog information', '', __LINE__, __FILE__, $sql);
			}

			$blogs = $db->sql_numrows($result);
			$blog_row = array();
			while ($row = $db->sql_fetchrow($result))
			{
				$blog_row[] = $row;
			}

			$template->assign_block_vars('switch_show_latest_entries', array());

			for ($i = 0; $i < $blogs; $i++)
			{
				if ( $blog_row[$i]['entry_text'] )
				{
					$last_entry_data = $blog_row[$i];

					// Mood
					$mood = array();
					$mood = find_mood($last_entry_data['entry_mood']);

					if ( $mood >= 0 )
					{
						$mood = sprintf($lang['Mood:'], '<img src="images/weblogs/' . $mood['mood_url'] . '" alt="' . $mood_data['mood_text'] . '" style="vertical-align: middle" border="0" />', $mood['mood_text']);
					}
					else
					{
						$mood = $lang['None'];
					}

					// Currently Icons
					$currently = array();
					$currently = find_action($last_entry_data['entry_currently']);

					if ( $currently > 0 )
					{
						$action = sprintf($lang['Currently:'], '<img src="images/weblogs/' . $currently['action_url'] . '" alt="' . $currently['action_text'] . ' ' . $last_entry_data['currently_text'] . '" style="vertical-align: middle" border="0" />',  $currently['action_text'] . ' ' . $last_entry_data['currently_text']);
					}
					else if ( $last_entry_data['currently_text'] && $currently == -2 )
					{
						$action = sprintf($lang['Currently:'], '', $last_entry_data['currently_text']);
					}
					else
					{
						$action = '';
					}
				}

				// Guest - show a hot folder image if number of replies exceeds hot level
				$replies = $blog_row[$i]['entry_replies'];
				if($replies >= $weblog_config['hot_level'])
				{
					$folder = $images['folder_hot'];
				}
				else
				{
					$folder = $images['folder'];
				}

				// User is logged in - check for new entries since last visit
				// and show a hot new folder image if new entry and number of replies exceeds hot level.
				// If just new entry then show the new folder image - else just show the folder image
				$newest_post_img = '';
				if( $userdata['session_logged_in'] )
				{
					if( $blog_row[$i]['entry_time'] > $userdata['user_lastvisit'] && $replies >= $weblog_config['hot_level'])
					{
						$folder = $images['folder_hot_new'];
						$newest_post_img = '<a href="' . append_sid("weblog_entry.$phpEx?" . 'e' . '=' . $blog_row[$i]['entry_id']) . '"><img src="' . $images['icon_newest_reply'] . '" border="0" /></a> ';
					}
					elseif( $blog_row[$i]['entry_time'] > $userdata['user_lastvisit'])
					{
						$folder = $images['folder_new'];
						$newest_post_img = '<a href="' . append_sid("weblog_entry.$phpEx?" . 'e' . '=' . $blog_row[$i]['entry_id']) . '"><img src="' . $images['icon_newest_reply'] . '" border="0" /></a> ';
					}
					elseif($replies >= $weblog_config['hot_level'])
					{
						$folder = $images['folder_hot'];
					}
					else
					{
						$folder = $images['folder'];
						$newest_post_img = '';
					}
				}

		$entry_poster = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . "u" . "=" . $blog_row[$i]['user_id']) . '">' . $blog_row[$i]['username'] . '</a>';

		// Has admin enabled currently in the entry block? If yes, then adjust colspan
		if ( $weblog_config['show_action'] )
		{
			$colspan = 2;
		}
		else
		{
			$colspan = 1;
		}

		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
		$template->assign_block_vars('switch_show_latest_entries.blog_row', array(
			'ENTRY_FOLDER_IMG' => $folder,
			'NEWEST_POST_IMG' => $newest_post_img,
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'LATEST_MOOD' => $mood,
			'U_LATEST_ENTRY' => append_sid("weblog_entry.$phpEx?" . 'e' . '=' . $blog_row[$i]['entry_id']),
			'L_LATEST_ENTRIES' => $blog_row[$i]['entry_subject'],
			'L_ENTRY_TEXT' => $blog_row[$i]['entry_text'],
			'L_ENTRY_REPLIES' => $blog_row[$i]['entry_replies'],
			'L_VIEWS' => $blog_row[$i]['entry_views'],
			'S_POSTER' => $entry_poster,
			'S_POSTTIME' => create_date($board_config['default_dateformat'], $blog_row[$i]['entry_time'], $board_config['board_timezone'])
			)
		);

		// Has admin enabled action in the entry block?
		if ( $weblog_config['show_action'] )
		{
			$template->assign_block_vars('switch_show_latest_entries.blog_row.switch_show_action', array(
			'LATEST_ACTION' => $action)
			);
		}
	}
}
// - Blog News =====
#
#-----[ OPEN ]-----
#
templates/subSilver/index_body.tpl

#
#-----[ FIND ]-----
# ps. 僅供參考; 請自行選擇欲加入其後的區塊 (表格)

代碼: 選擇全部

<table cellspacing="3" border="0" align="center" cellpadding="0">
  <tr> 
	<td width="20" align="center"><img src="templates/subSilver/images/folder_new_big.gif" alt="{L_NEW_POSTS}"/></td>
	<td><span class="gensmall">{L_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center"><img src="templates/subSilver/images/folder_big.gif" alt="{L_NO_NEW_POSTS}" /></td>
	<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center"><img src="templates/subSilver/images/folder_locked_big.gif" alt="{L_FORUM_LOCKED}" /></td>
	<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
  </tr>
</table>
#
#-----[ AFTER, ADD ]-----
#

代碼: 選擇全部

<br>
<!-- BEGIN switch_show_latest_entries -->
<table width="100%" cellspacing="1" cellpadding="5" align="center" class="forumline">
	<tr> 
		<td colspan="7" nowrap="nowrap" class="catHead"><span class="cattitle"><a href="{U_WEBLOGS_NEWS}" title="{L_WEBLOGS_NEWS}" class="cattitle">{L_WEBLOGS_NEWS}</a></span></td> 
	</tr> 
	<tr>
		<th width="3%">&nbsp;</th>
		<th width="47%" colspan="2">{L_LATEST_ENTRIES}</th>
		<th nowrap="nowrap">{L_LATEST_MOOD}</th>
		<th>{L_AUTHOR}</th>
		<th>{L_VIEWS}</th>
		<th>{L_LASTPOST}</th>
	</tr>
	<!-- BEGIN blog_row -->
	<tr>
		<td class="{switch_show_latest_entries.blog_row.ROW_CLASS}" align="center"><img src="{switch_show_latest_entries.blog_row.ENTRY_FOLDER_IMG}"></td>
		<td class="{switch_show_latest_entries.blog_row.ROW_CLASS}" nowrap="nowrap">{switch_show_latest_entries.blog_row.NEWEST_POST_IMG}<span class="topictitle"><a href="{switch_show_latest_entries.blog_row.U_LATEST_ENTRY}">{switch_show_latest_entries.blog_row.L_LATEST_ENTRIES}</a></span><span class="genmed">&nbsp; ({switch_show_latest_entries.blog_row.L_ENTRY_REPLIES} {L_REPLIES})</span>
		<!-- BEGIN switch_show_action -->
		<td width="20%" align="right" class="{switch_show_latest_entries.blog_row.ROW_CLASS} align="right"><span class="genmed">{switch_show_latest_entries.blog_row.switch_show_action.LATEST_ACTION}</span></td>
		<!-- END switch_show_action -->
			</td>
		<td width="20%" class="{switch_show_latest_entries.blog_row.ROW_CLASS}" align="center"><span class="genmed">{switch_show_latest_entries.blog_row.LATEST_MOOD}</span></td>
		<td width="15%" class="{switch_show_latest_entries.blog_row.ROW_CLASS}" align="center"><span class="genmed">{switch_show_latest_entries.blog_row.S_POSTER}</span></td>
		<td width="10%" class="{switch_show_latest_entries.blog_row.ROW_CLASS}" align="center"><span class="genmed">{switch_show_latest_entries.blog_row.L_VIEWS}</span></td>
		<td width="100" class="{switch_show_latest_entries.blog_row.ROW_CLASS}" align="center"><span class="genmed">{switch_show_latest_entries.blog_row.S_POSTTIME}</span></td>
	</tr>
	<!-- END blog_row -->
	<tr>
	  <td colspan="7" class="catBottom" align="center" valign="middle" colspan="6" height="28"><span class="genmed">&nbsp;</span></td>
	</tr>
</table>
<!-- END switch_show_latest_entries -->
#
#-----[ SAVE & CLOSE ]-----
#
#End

DEMO:
http://wang5555.dnsfor.me/phpbb2/weblogs_news.php
http://wang5555.dnsfor.me/phpbb2/index.php
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
davidhuang
星球公民
星球公民
文章: 33
註冊時間: 2007-01-31 13:29

太棒了

文章 davidhuang »

我還能說什麼呢??...心靈兄真的是太棒太強了.....謝謝.
yzcjbnp
星球普通子民
星球普通子民
文章: 2
註冊時間: 2008-02-26 22:12

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 yzcjbnp »

不好意思我想請問一下
為什麼我按照上面的程式加入之後
首頁還是什麼都沒有出現.....
是需要先安裝過什麼、才可以使用嗎?
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 心靈捕手 »

yzcjbnp 寫:不好意思我想請問一下
為什麼我按照上面的程式加入之後
首頁還是什麼都沒有出現.....
是需要先安裝過什麼、才可以使用嗎?
您必須先安裝 Blog Mod.

建議您:
貼出論壇網址.
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
白狼王
星球普通子民
星球普通子民
文章: 4
註冊時間: 2008-06-20 06:38

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 白狼王 »

在下有安裝過這個 Blog Mod 外掛,粉好用

不過,希望有程式高手可以寫出,如何在網誌頁面顯示 "最新被回應的主題"
許久前的文章被回應了,作者都完全不知道 @@
又不可能整天去翻 /weblogs_news.php @@

其次是 "個人網誌內文搜尋"

該網誌的官方論壇關閉很久了 http://www.theblodmod.com
紀得以前還有付費外掛版,現在即使想花錢叫他們寫都沒找不到人 :((
jwxinst
竹貓忠實會員
竹貓忠實會員
文章: 945
註冊時間: 2006-03-31 10:07
來自: New York, USA     學業狀況: 當天才...       個人狀況: 臭蛋
聯繫:

Re: [問題] 討論區首頁如何加入『最新網誌文章』列表 - Blog Mod (網誌)

文章 jwxinst »

樓上的
我現在沒有2.0的安裝
所以無法測試

但看了老師上面 Before ADD
他也只是抽出大部份的code

news這個檔案包了new entry和latest reply
我想你只要抽出大部份的code就可以了

就按老師的加法, 我再加這麼一段


FIND

代碼: 選擇全部

    // - Blog News =====
BEFORE, ADD

代碼: 選擇全部

//
// Latest Replies
//

// This one is really goofy - if Entry Block is on, disable pagination for replies.
if ( $weblog_config['show_latest_entries'] )
{
	$start_reply = '';
}
else
{
	$start_reply = "$start,";
}
//
$sql = "SELECT r.reply_id, r.entry_id, r.poster_id, r.post_time, r.post_username, r.reply_text, r.bbcode_uid, r.enable_bbcode, r.enable_smilies, u.user_id, u.username, u.user_weblog, e.entry_id, e.weblog_id, e.entry_subject, e.entry_access, e.entry_replies, w.weblog_id, w.weblog_name
		FROM " . WEBLOG_REPLIES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . WEBLOG_ENTRIES_TABLE . " AS e, " . WEBLOGS_TABLE . " AS w
		WHERE entry_access  <= $auth_level
		AND r.poster_id = u.user_id
		AND e.entry_id = r.entry_id
		AND e.weblog_id = w.weblog_id
		AND entry_deleted <> " . TRUE . "
		ORDER BY reply_id DESC
		LIMIT $start_reply " . $weblog_config['latest_reply_max'];
		if (!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Could not query blog information', '', __LINE__, __FILE__, $sql);
		}

		$replies = $db->sql_numrows($result);
		$replies_row = array();
		while ($row = $db->sql_fetchrow($result))
		{
			$replies_row[] = $row;
		}

if ( $weblog_config['show_latest_replies'] )
{
	$template->assign_block_vars('switch_show_latest_replies', array());

	for ($i = 0; $i < $replies; $i++)
	{
		// BBCode
		if ( $board_config['allow_bbcode'] )
		{
			if ( $replies_row[$i]['enable_bbcode'] )
			{
				$replies_row[$i]['reply_text'] = ( $replies_row[$i]['bbcode_uid'] ) ? bbencode_second_pass($replies_row[$i]['reply_text'], $replies_row[$i]['bbcode_uid']) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $replies_row[$i]['reply_text']);
			}
		}

		$replies_row[$i]['reply_text'] = make_clickable($replies_row[$i]['reply_text']);

		// Smilies
		if ( $board_config['allow_smilies'] )
		{
			if ( $replies_row[$i]['enable_smilies'] )
			{
				$replies_row[$i]['reply_text'] = smilies_pass($replies_row[$i]['reply_text']);
			}
		}

		// User is anonymous but enters a name
		if ( $replies_row[$i]['poster_id'] == '-1' && $replies_row[$i]['post_username'] != '' )
		{
			$poster = $replies_row[$i]['post_username'];
		}
		else
		{
			$poster = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . "u" . "=" . $replies_row[$i]['user_id']) . '">' . $replies_row[$i]['username'] . '</a>';
		}

		// Hot or not
		$replies_replies = $replies_row[$i]['entry_replies'];

		if($replies_replies  >= $weblog_config['hot_level'])
		{
			$folder = $images['folder_hot'];
		}
		else
		{
			$folder = $images['folder'];
		}

		// User is logged in - check for new replies since last visit
		// and show a hot new folder image if new reply and number of replies exceeds hot level.
		// If just new reply then show the new folder image - else just show the folder image
		$newest_post_img = '';
		if( $userdata['session_logged_in'] )
		{
			if( $replies_row[$i]['post_time'] > $userdata['user_lastvisit'] && $replies_replies >= $weblog_config['hot_level'])
			{
				$folder = $images['folder_hot_new'];
				$newest_post_img = '<a href="' . append_sid("weblog_entry.$phpEx?" . POST_REPLY_URL . '=' . $replies_row[$i]['reply_id'] . '#' . $replies_row[$i]['reply_id']) . '"><img src="' . $images['icon_newest_reply'] . '" border="0" /></a> ';
			}

			elseif( $replies_row[$i]['post_time'] > $userdata['user_lastvisit'])
			{
				$folder = $images['folder_new'];
				$newest_post_img = '<a href="' . append_sid("weblog_entry.$phpEx?" . POST_REPLY_URL . '=' . $replies_row[$i]['reply_id'] . '#' . $replies_row[$i]['reply_id']) . '"><img src="' . $images['icon_newest_reply'] . '" border="0" /></a> ';
			}

			elseif($replies_replies >= $weblog_config['hot_level'])
			{
				$folder = $images['folder_hot'];
			}
			else
			{
				$folder = $images['folder'];
				$newest_post_img = '';
			}
		}

		// Alternating row colors
		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

		// Send the loopdata to the template
		$template->assign_block_vars('switch_show_latest_replies.replies_row', array(
			'REPLY_FOLDER_IMG' => $folder,
			'NEWEST_POST_IMG' => $newest_post_img,
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'U_LATEST_REPLY' => append_sid("weblog_entry.$phpEx?" . POST_REPLY_URL . '=' . $replies_row[$i]['reply_id'] . '#' . $replies_row[$i]['reply_id']),
			'U_BLOG_NAME' => append_sid("weblog.$phpEx?" . 'w' . '=' . $replies_row[$i]['weblog_id']),
			'L_LATEST_REPLY' => $replies_row[$i]['entry_subject'],
			'L_BLOG_NAME' => $replies_row[$i]['weblog_name'],
			'S_POSTER' => $poster,
			'S_REPLYTIME' => create_date($board_config['default_dateformat'], $replies_row[$i]['post_time'], $board_config['board_timezone'])
			)
		);

		// Has admin enabled comments in the reply block?
		if ( $weblog_config['show_comments'] )
		{
			$template->assign_block_vars('switch_show_latest_replies.replies_row.switch_show_comments', array(
			'L_REPLY_TEXT' => $replies_row[$i]['reply_text'])
			);
		}
	}
}

// If Admin chooses not to show any blocks on the Weblog News page, show the un-suspecting user a nice message
if ( !$weblog_config['show_latest_entries'] && !$weblog_config['show_latest_replies'] )
{
	$template->assign_block_vars('switch_no_blocks', array());
}

// Pagination. Only run this if entries are on. Else, save a query
if ( $weblog_config['show_latest_entries'] )
{
	$sql = "SELECT count(*) AS total
			FROM " . WEBLOG_ENTRIES_TABLE . "
			WHERE entry_access <= $auth_level
			AND entry_deleted <> " . TRUE . "";

	if ( !($result = $db->sql_query($sql)) )
	{
	   message_die(GENERAL_ERROR, 'Error getting total entries', '', __LINE__, __FILE__, $sql);
	}

	if ( $total = $db->sql_fetchrow($result) )
	{
	   $total_entry_items = $total['total'];
	   $pagination = generate_pagination("weblogs_news.php?$mode=$mode&order=$sort_order", $total_entry_items, $weblog_config['latest_entry_max'], $start);
	}
	$template->assign_vars(array(
	'PAGINATION' => $pagination,
	'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $weblog_config['latest_entry_max'] ) + 1 ), ceil( $total_entry_items / $weblog_config['latest_entry_max'] ))
	)
);
}

// Pagination Replies. Only run this if entries are off. Else save a query
// and a lot of trouble. Assign alternate text to template. Think of a better way to do this.
if ( !$weblog_config['show_latest_entries'] )
{
	$sql = "SELECT count(*) AS total
			FROM " . WEBLOG_REPLIES_TABLE . "";

	if ( !($result = $db->sql_query($sql)) )
	{
	   message_die(GENERAL_ERROR, 'Error getting total replies', '', __LINE__, __FILE__, $sql);
	}

	if ( $total = $db->sql_fetchrow($result) )
	{
	   $total_reply_items = $total['total'];
	   $pagination_replies = generate_pagination("weblogs_news.php?$mode=$mode&order=$sort_order", $total_reply_items, $weblog_config['latest_reply_max'], $start);
	}

	$template->assign_vars(array(
		'PAGINATION_REPLIES' => $pagination_replies,
		'PAGE_NUMBER_REPLIES' => sprintf($lang['Page_of'], ( floor( $start / $weblog_config['latest_reply_max'] ) + 1 ), ceil( $total_reply_items / $weblog_config['latest_reply_max'] ))
		)
	);
}
TPL也跟上面的差不多了
但我想PHP這邊的CODE很有可能會出錯
因為最後的這裡的問題
)
);
}
目前狀態圖檔
GoKo Music進度: 10%

問個問題不要緊可是沒有發文格式、問題不夠詳細情況,難道要用猜嗎?
新手必讀
[教學] 基本認識、學習、隨我架設phpBB的新手通 -更新至2.0.22
問問題的技巧
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=44340
MOD安裝教學及轉碼
http://www.phpbb-tw.net/phpbb/viewtopic.php?t=22832
主題已鎖定

回到「外掛問題討論」