參考網址:http://phpbb-tw.net/phpbb/viewtopic.php ... %C2%F7%BDu
這個MOD可以在文章旁邊的發表人資料內加入發表人上線的狀態.
代碼: 選擇全部
#
#----- [ 開啟 viewtopic.php] --------
#
#
#----- [ 尋找下面這段] ------
#
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
$limit_posts_time
ORDER BY p.post_time $post_time_order
LIMIT $start, ".$board_config['posts_per_page'];
#
#----- [ 替換為 ] ------
#
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile[color=red], u.user_allow_viewonline, u.user_session_time[/color], p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
$limit_posts_time
ORDER BY p.post_time $post_time_order
LIMIT $start, ".$board_config['posts_per_page'];
#
#----- [ 尋找下面這段 (約一千多行的地方) ] ------
#
'POSTER_FROM' => $poster_from,
'POSTER_AVATAR' => $poster_avatar,
#
#----- [ 在下面加入 ] -----
#
'POSTER_ONLINE' => (($postrow[$i]['user_session_time'] >= ( time() - 300 )) && ($postrow[$i]['user_allow_viewonline'])) ? '<span style="color:' . $theme['fontcolor2'] . ';"><img border="0" src="templates/subSilver/images/Online.gif" alt="上線中...." width="[color=red]14[/color]" height="[color=red]16[/color]"></span>' : '<span style="color:' . $theme['fontcolor3'] . ';"><img border="0" src="templates/subSilver/images/Offline.gif" alt="離線中...." width="[color=red]14[/color]" height="[color=red]16[/color]"></span>',
#
#----- [ 關閉 viewtopic.php ] --------
(1)打開 viewtopic_body.tpl
找\r
代碼: 選擇全部
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
</tr>
代碼: 選擇全部
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
<td align="right">{postrow.POSTER_ONLINE}</td>
</tr>
![圖檔](http://220.130.79.94/phpBB2_game/photo_tmp/on_offline2.gif)
(2)打開 viewtopic_body.tpl
尋找\r
代碼: 選擇全部
<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
<tr>
<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!--
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
document.write(' {postrow.ICQ_IMG}');
else
document.write('</td><td> </td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
</tr>
</table></td>
</tr>
代碼: 選擇全部
<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap">
<table cellspacing="0" cellpadding="0" border="0" height="18" width="100%">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
<tr>
<td nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!--
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
document.write(' {postrow.ICQ_IMG}');
else
document.write('</td><td> </td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
</tr>
</table>
</td>
<td align="right">{postrow.POSTER_ONLINE}</td>
</tr>
</table>
</td>
</tr>
![圖檔](http://220.130.79.94/phpBB2_game/photo_tmp/on_offline.gif)
感謝大家的幫忙,稍微將心得整理一下,分享給需要的朋友!