FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » How to Add in Code After First Post
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
How to Add in Code After First Post [message #159250] Fri, 15 May 2009 22:37 Go to next message
Jay D. is currently offline  Jay D.   United States
Messages: 22
Registered: September 2005
Location: West Palm
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I am trying to add in some code after the first topic post. Please tell me if I am in heading in the correct direction:
<?php
$i = 1;
?>
{MAIN_SECTION: message_entry Message Entry (a single message)}<tr>
	<td class="MsgSpacer">
		<table cellspacing=0 cellpadding=0 border="0" class="MsgTable">
			<tr>
				<td class="MsgR1 vt al MsgSubText">
				<a name="msg_num_{VAR: m_num}"></a><a
				name="msg_{VAR: obj->id}"></a>{IF: $obj->icon && !$hide_controls}<img src="images/message_icons/{VAR: obj->icon}" alt="{VAR: obj->icon}" />&nbsp;&nbsp;{ENDIFI}{VAR: obj->subject}{TEMPLATE-DATA: rpl}
				</td>
				<td class="MsgR1 vt ar"><span class="DateText">{TEMPLATE: dmsg_post_date}</span> {TEMPLATE-DATA: prev_message}{TEMPLATE-DATA: next_message}
			</td>
		</tr>
		<tr>
			<td colspan="2">
			<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
			<tr>
				<td class="MsgR2" width="200" valign="top">
					<table cellspacing="0" cellpadding="0" class=""  width="200" >
						<tr class="MsgR2">
							<td class="msgud">
							{TEMPLATE-DATA: online_indicator}{TEMPLATE-DATA: user_link}{IF: !$hide_controls}{IF: $obj->user_id}<br /><b>{MSG: posts_c}</b> {VAR: obj->posted_msg_count}<br /><b>{MSG: registered}</b> {TEMPLATE: dmsg_join_date} {TEMPLATE-DATA: location}{ENDIFI}{ENDIFI}
							</td>
						</tr>
						<tr>
							<td class="msgud">{TEMPLATE-DATA: avatar}</td>
						</tr>
						<tr class="MsgR2">
							<td class="msgud">{TEMPLATE-DATA: dmsg_tags}</td>
						</tr>
						<tr class="MsgR2" valign="bottom">
							<td class="msgot">{TEMPLATE-DATA: dmsg_bd_il}{TEMPLATE-DATA: dmsg_im_row}{IF: !$hide_controls}{IF: ($obj->host_name && $o1 & 268435456)}<b>{MSG: from}</b> {VAR: obj->host_name}<br />{ENDIFI}{IF: ($b & 1048576 || $usr->md || $o1 & 134217728)}<b>{MSG: dmsg_ip}</b> <a href="{TEMPLATE: dmsg_ip_address_url}" target="_blank">{VAR: obj->ip_addr}</a>{ENDIFI}{ENDIFI}
							</td>
						</tr>
					</table>
				</td>
				<td class="MsgR3 MsgBodyText" valign="top">
				{TEMPLATE-DATA: msg_body}{TEMPLATE-DATA: drawmsg_file_attachments}
				{TEMPLATE-DATA: modified_message}{IF: !$hide_controls}{IF: ($obj->sig && $o1 & 32768 && $obj->msg_opt & 1 && $b & 4096 && !($a & 67108864))}<p /><hr class="sig" />{VAR: obj->sig}{ENDIFI}{ENDIFI}
				</td>
			</tr>
			{IF: !$hide_controls}{TEMPLATE: dmsg_message_toolbar}{ENDIFI}
			</table>
			</td>
		</tr>
	</table>
	</td>
</tr>
{VAR: $i++}
{IF: $i == 1}<!-- -->{ENDIFI}{MAIN_SECTION: END}


Of Course this is in the drawmsg.tmpl
Thanks
Jay


howdy

[Updated on: Fri, 15 May 2009 22:37]

Report message to a moderator

Re: How to Add in Code After First Post [message #159262 is a reply to message #159250] Sat, 16 May 2009 16:59 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
See http://fudforum.org/forum/index.php?t=msg&goto=35122 -

"You probably need to edit msg.tmpl which is what displays all the messages, rather then drawmsg.tmpl that deals with drawing of message content for every message."

Let us know how it goes.

Best regards.

Frank
Re: How to Add in Code After First Post [message #159263 is a reply to message #159250] Sat, 16 May 2009 17:41 Go to previous messageGo to next message
Jay D. is currently offline  Jay D.   United States
Messages: 22
Registered: September 2005
Location: West Palm
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
OK, I have this in the correct place. I just need to know how to do a count on the loop of messages being displayed.

in Php, i can do a:
$i = 1;

while(someting){
if($i == 2){
do something
$i++;
}


But I'm not sure how to do it with fud code. I just want to make a banner show up under the first message. No other message.


howdy
Re: How to Add in Code After First Post [message #159269 is a reply to message #159263] Sun, 17 May 2009 08:15 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
This should do the trick:

Index: drawmsg.tmpl
===================================================================
RCS file: /forum21/install/forum_data/thm/default/tmpl/drawmsg.tmpl,v
retrieving revision 1.93
diff -u -r1.93 drawmsg.tmpl
--- drawmsg.tmpl        3 Apr 2009 05:40:32 -0000       1.93
+++ drawmsg.tmpl        17 May 2009 12:13:36 -0000
@@ -355,6 +355,7 @@
 </td></tr>
 {IF: !$hide_controls}{TEMPLATE: dmsg_message_toolbar}{ENDIFI}
 </table></td></tr>
+{IF: !$obj->reply_to}<tr><td>Put your ad here!</td></tr>{ENDIFI}
 {MAIN_SECTION: END}

 {SECTION: dmsg_no_msg_body}
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: HOWTO concat two threads ?
Next Topic: How to change default options in register page
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Oct 22 22:43:32 EDT 2017

Total time taken to generate the page: 0.00492 seconds