[ALPHA] First post separated

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
User avatar
Tsubaru
Registered User
Posts: 27
Joined: Wed Sep 03, 2003 7:16 pm
Contact:

[ALPHA] First post separated

Post by Tsubaru »

MOD Title: First post separated
MOD Description: Separate the first post of the topic, so you can give it's own look.
MOD Version: 1.0

MOD Download: Sorry. You'll have to copy and paste the code to your notepad.
MOD Preview: Page 1 of the topic Page 2 of the topic

**NOTE 1**: This is my first mod. Enjoy!

Code: Select all

########################################################### 
## MOD Title: First post separated
## MOD Author: Tsubaru
## MOD Description: Separate the first post of the topic, so you can give it's own look.
## MOD Version: 1.0
## 
## Installation Level: easy
## Installation Time: 10 Minutes 
## Files To Edit: (5) 
##			viewtopic.php
##			templates\subSilver\viewtopic_body.tpl
##			templates\subSilver\viewtopic_poll_ballot.tpl
##			templates\subSilver\viewtopic_poll_result.tpl
##	         	language/lang_english/lang_main.php
## Included Files: n/a
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/
############################################################## 
## Author Notes: 
##  If you want to separete the first post of every page of the topic,
##  remove this ' && $start == 0' from the code.
##  
##  My Personal WebSite Survival Network
##  http://web.1asphost.com/survivalnet/
############################################################## 

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

viewtopic.php

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

	'L_MESSAGE' => $lang['Message'],

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

	'L_POLL' => $lang['Poll'],

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

	//
	// Again this will be handled by the templating
	// code at some point
	//
	$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
	$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

	$template->assign_block_vars('postrow', array(
		'ROW_COLOR' => '#' . $row_color,
		'ROW_CLASS' => $row_class,
		'POSTER_NAME' => $poster,
		'POSTER_RANK' => $poster_rank,
		'RANK_IMAGE' => $rank_image,
		'POSTER_JOINED' => $poster_joined,
		'POSTER_POSTS' => $poster_posts,
		'POSTER_FROM' => $poster_from,
		'POSTER_AVATAR' => $poster_avatar,
		'POST_DATE' => $post_date,
		'POST_SUBJECT' => $post_subject,
		'MESSAGE' => $message,
		'SIGNATURE' => $user_sig,
		'EDITED_MESSAGE' => $l_edited_by,

		'MINI_POST_IMG' => $mini_post_img,
		'PROFILE_IMG' => $profile_img,
		'PROFILE' => $profile,
		'SEARCH_IMG' => $search_img,
		'SEARCH' => $search,
		'PM_IMG' => $pm_img,
		'PM' => $pm,
		'EMAIL_IMG' => $email_img,
		'EMAIL' => $email,
		'WWW_IMG' => $www_img,
		'WWW' => $www,
		'ICQ_STATUS_IMG' => $icq_status_img,
		'ICQ_IMG' => $icq_img,
		'ICQ' => $icq,
		'AIM_IMG' => $aim_img,
		'AIM' => $aim,
		'MSN_IMG' => $msn_img,
		'MSN' => $msn,
		'YIM_IMG' => $yim_img,
		'YIM' => $yim,
		'EDIT_IMG' => $edit_img,
		'EDIT' => $edit,
		'QUOTE_IMG' => $quote_img,
		'QUOTE' => $quote,
		'IP_IMG' => $ip_img,
		'IP' => $ip,
		'DELETE_IMG' => $delpost_img,
		'DELETE' => $delpost,

		'L_MINI_POST_ALT' => $mini_post_alt,

		'U_MINI_POST' => $mini_post_url,
		'U_POST_ID' => $postrow[$i]['post_id'])
	);


# 
#-----[ REPLACE WITH ]------------------------------------------ 
#

	//---------------------------------------------------------------------------------
	// Again this will be handled by the templating code at some point
	//---------------------------------------------------------------------------------
	//---------------------------------------------------------------------------------
	// FIRST POST MOD
	//---------------------------------------------------------------------------------
	if ($i == 0 && $start == 0)
	{
		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

		$template->assign_block_vars('i', array(
			'ROW_COLOR' => '#' . $row_color,
			'ROW_CLASS' => $row_class,
			'POSTER_NAME' => $poster,
			'POSTER_RANK' => $poster_rank,
			'RANK_IMAGE' => $rank_image,
			'POSTER_JOINED' => $poster_joined,
			'POSTER_POSTS' => $poster_posts,
			'POSTER_FROM' => $poster_from,
			'POSTER_AVATAR' => $poster_avatar,
			'POST_DATE' => $post_date,
			'POST_SUBJECT' => $post_subject,
			'MESSAGE' => $message,
			'SIGNATURE' => $user_sig,
			'EDITED_MESSAGE' => $l_edited_by,

			'MINI_POST_IMG' => $mini_post_img,
			'PROFILE_IMG' => $profile_img,
			'PROFILE' => $profile,
			'SEARCH_IMG' => $search_img,
			'SEARCH' => $search,
			'PM_IMG' => $pm_img,
			'PM' => $pm,
			'EMAIL_IMG' => $email_img,
			'EMAIL' => $email,
			'WWW_IMG' => $www_img,
			'WWW' => $www,
			'ICQ_STATUS_IMG' => $icq_status_img,
			'ICQ_IMG' => $icq_img,
			'ICQ' => $icq,
			'AIM_IMG' => $aim_img,
			'AIM' => $aim,
			'MSN_IMG' => $msn_img,
			'MSN' => $msn,
			'YIM_IMG' => $yim_img,
			'YIM' => $yim,
			'EDIT_IMG' => $edit_img,
			'EDIT' => $edit,
			'QUOTE_IMG' => $quote_img,
			'QUOTE' => $quote,
			'IP_IMG' => $ip_img,
			'IP' => $ip,
			'DELETE_IMG' => $delpost_img,
			'DELETE' => $delpost,

			'L_MINI_POST_ALT' => $mini_post_alt,

			'U_MINI_POST' => $mini_post_url,
			'U_POST_ID' => $i[$i]['post_id'])
		);
	}
	else
	{
	//---------------------------------------------------------------------------------
	// FIRST POST MOD
	//---------------------------------------------------------------------------------

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

		$template->assign_block_vars('postrow', array
		(
			'ROW_COLOR' => '#' . $row_color,
			'ROW_CLASS' => $row_class,
			'POSTER_NAME' => $poster,
			'POSTER_RANK' => $poster_rank,
			'RANK_IMAGE' => $rank_image,
			'POSTER_JOINED' => $poster_joined,
			'POSTER_POSTS' => $poster_posts,
			'POSTER_FROM' => $poster_from,
			'POSTER_AVATAR' => $poster_avatar,
			'POST_DATE' => $post_date,
			'POST_SUBJECT' => $post_subject,
			'MESSAGE' => $message,
			'SIGNATURE' => $user_sig,
			'EDITED_MESSAGE' => $l_edited_by,

			'MINI_POST_IMG' => $mini_post_img,
			'PROFILE_IMG' => $profile_img,
			'PROFILE' => $profile,
			'SEARCH_IMG' => $search_img,
			'SEARCH' => $search,
			'PM_IMG' => $pm_img,
			'PM' => $pm,
			'EMAIL_IMG' => $email_img,
			'EMAIL' => $email,
			'WWW_IMG' => $www_img,
			'WWW' => $www,
			'ICQ_STATUS_IMG' => $icq_status_img,
			'ICQ_IMG' => $icq_img,
			'ICQ' => $icq,
			'AIM_IMG' => $aim_img,
			'AIM' => $aim,
			'MSN_IMG' => $msn_img,
			'MSN' => $msn,
			'YIM_IMG' => $yim_img,
			'YIM' => $yim,
			'EDIT_IMG' => $edit_img,
			'EDIT' => $edit,
			'QUOTE_IMG' => $quote_img,
			'QUOTE' => $quote,
			'IP_IMG' => $ip_img,
			'IP' => $ip,
			'DELETE_IMG' => $delpost_img,
			'DELETE' => $delpost,

			'L_MINI_POST_ALT' => $mini_post_alt,

			'U_MINI_POST' => $mini_post_url,
			'U_POST_ID' => $postrow[$i]['post_id']
		)
		);
	}

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

templates\subSilver\viewtopic_body.tpl

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

<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
	<tr align="right">
		<td class="catHead" colspan="2" height="28"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}" class="nav">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}" class="nav">{L_VIEW_NEXT_TOPIC}</a> &nbsp;</span></td>
	</tr>
	{POLL_DISPLAY} 
	<tr>
		<th class="thLeft" width="150" height="26" nowrap>{L_AUTHOR}</th>
		<th class="thRight" nowrap>{L_MESSAGE}</th>
	</tr>
	<!-- BEGIN postrow -->
	<tr> 
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" nowrap>{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
	</tr>
	<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><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
			<tr> 
				<td valign="middle" 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>&nbsp;</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>
	<tr> 
		<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END postrow -->
	<tr align="center"> 
		<td class="catBottom" colspan="2" height="28"><table cellspacing="0" cellpadding="0" border="0">
			<tr><form method="post" action="{S_POST_DAYS_ACTION}">
				<td align="center"><span class="gensmall">{L_DISPLAY_POSTS}: {S_SELECT_POST_DAYS}&nbsp;{S_SELECT_POST_ORDER}&nbsp;<input type="submit" value="{L_GO}" class="liteoption" name="submit" /></span></td>
			</form></tr>
		</table></td>
	</tr>
</table>

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

{POLL_DISPLAY}
<!-- BEGIN i -->
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
	<tr align="right">
		<td class="catHead" colspan="2" height="28"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}" class="nav">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}" class="nav">{L_VIEW_NEXT_TOPIC}</a> &nbsp;</span></td>
	</tr>
	<tr>
		<th class="thLeft" width="150" height="26" nowrap>{L_AUTHOR}</th>
		<th class="thRight" nowrap>{L_MESSAGE}</th>
	</tr>
	<tr> 
		<td width="150" align="left" valign="top" class="{i.ROW_CLASS}"><span class="name"><a name="{i.U_POST_ID}"></a><b>{i.POSTER_NAME}</b></span><br /><span class="postdetails">{i.POSTER_RANK}<br />{i.RANK_IMAGE}{i.POSTER_AVATAR}<br /><br />{i.POSTER_JOINED}<br />{i.POSTER_POSTS}<br />{i.POSTER_FROM}</span><br /></td>
		<td class="{i.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{i.U_MINI_POST}"><img src="{i.MINI_POST_IMG}" width="12" height="9" alt="{i.L_MINI_POST_ALT}" title="{i.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {i.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {i.POST_SUBJECT}</span></td>
				<td valign="top" nowrap>{i.QUOTE_IMG} {i.EDIT_IMG} {i.DELETE_IMG} {i.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{i.MESSAGE}{i.SIGNATURE}</span><span class="gensmall">{i.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="{i.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="{i.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
			<tr> 
				<td valign="middle" nowrap>{i.PROFILE_IMG} {i.PM_IMG} {i.EMAIL_IMG} {i.WWW_IMG} {i.AIM_IMG} {i.YIM_IMG} {i.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(' {i.ICQ_IMG}');
	else
		document.write('</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{i.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{i.ICQ_STATUS_IMG}</div></div>');
				
				//-->
				</script>
				<noscript>{i.ICQ_IMG}</noscript>
				</td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<tr align="center"> 
    <td class="catBottom" colspan="2" height="28">&nbsp;</td>
	</tr>
</table>
<hr>
<!-- END i -->

# 
#-----[ FIND AND DELETE ]----------------------------------------- 
#
#Note: Delete the second.
#

{POLL_DISPLAY}

# 
#-----[ FIND AND DELETE ]----------------------------------------- 
#
#Note: Delete the second.
#

	<tr align="right">
		<td class="catHead" colspan="2" height="28"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}" class="nav">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}" class="nav">{L_VIEW_NEXT_TOPIC}</a> &nbsp;</span></td>
	</tr>

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

templates\subSilver\viewtopic_poll_ballot.tpl

# 
#-----[ ADD BEFORE EVERY THING ]----------------------------------------- 
#

<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
  <tr>
    <th class="thLeft">{L_POLL}</th>

# 
#-----[ ADD AFTER EVERY THING ]----------------------------------------- 
#

</table>
<hr>

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

templates\subSilver\viewtopic_poll_result.tpl

# 
#-----[ ADD BEFORE EVERY THING ]----------------------------------------- 
#

<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
  <tr>
    <th class="thLeft">{L_POLL}</th>

# 
#-----[ ADD AFTER EVERY THING ]----------------------------------------- 
#

</table>
<hr>

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

language/lang_english/lang_main.php

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

$lang['Message'] = 'Message';

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

$lang['Poll'] = 'Poll';

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
User avatar
Marnboorapa
Registered User
Posts: 84
Joined: Sat Jan 08, 2005 3:19 pm
Location: Thailand
Contact:

Post by Marnboorapa »

Now I trying to make the first which separated is alway topic's first post.

Any Idea ?
Post Reply

Return to “[2.0.x] MODs in Development”