View Full Version : First Post Conditional
the Sandman
05-05-2004, 12:07 PM
I need a conditional that will allow me to differentiate first posts from the rest of the posts in a Thread.
I've removed the Title field from the newreply template so members replying to a Thread cannot add a title. So, only the frst post in the Thread has a title. Now, I'd like to remove the Thread icon and the line that goes beneath the Thread icon and title on any post after the first post.
Zachery posted (at vBulletin.com) that "$post[count] is the varible - it numbers each post in the thread". But I've been unable to construct a proper conditional - no matter what I've tried either all the posts have the Thread icon and title area or none do. How can I accomplish what I want?
NTLDR
05-05-2004, 12:18 PM
<if condition="$FIRSTPOSTID == $post['postid']">
<!-- this is the first post -->
<else />
<!-- this is the second, third etc post -->
</if>
the Sandman
05-05-2004, 12:48 PM
I must be screwing somethin up. Here's the part of the postbit template in question:
<if condition="$show['messageicon'] OR $post['title']">
<!-- icon and title -->
<div class="smallfont">
<if condition="$show['messageicon']"><img class="inlineimg" src="$post[iconpath]" alt="$post[icontitle]" border="0" /></if>
<if condition="$post['title']"><strong>$post[title]</strong></if>
</div>
<hr size="1" color="$stylevar[tborder_bgcolor]" />
<!-- / icon and title -->
</if> Where would you add the conditional statements to show the usual message icon and title for the first post and only a linebreak in that area for any other posts? I tried a couple of ways and each time was unable to get the first post correct.
NTLDR
05-05-2004, 01:12 PM
<if condition="$show['messageicon'] OR $post['title']">
<!-- icon and title -->
<if condition="$FIRSTPOSTID == $post['postid']">
<div class="smallfont">
<if condition="$show['messageicon']"><img class="inlineimg" src="$post[iconpath]" alt="$post[icontitle]" border="0" /></if>
<if condition="$post['title']"><strong>$post[title]</strong></if>
</div>
</if>
<hr size="1" color="$stylevar[tborder_bgcolor]" />
<!-- / icon and title -->
</if>
the Sandman
05-05-2004, 01:22 PM
Thanks for taking time and helping me with this... but the first post is still not shown differently from the others. In other words, the message icon and title are not displayed in any posts including the first post.
Boofo
05-05-2004, 01:26 PM
Lee, shouldn't that actually be this?
<if condition="$post['postid'] == $FIRSTPOSTID">
Boofo
05-05-2004, 02:27 PM
Ok, I found the solution to your problem. This is what you need to use to find the first post in a thread:
<if condition="$post['postid'] == $thread['firstpostid']">
the Sandman
05-05-2004, 03:03 PM
Thanks Boofo, that's got it!Ok, I found the solution to your problem. This is what you need to use to find the first post in a thread:
<if condition="$post['postid'] == $thread['firstpostid']">
Boofo
05-05-2004, 05:14 PM
Thanks Boofo, that's got it!
You're very welcome, sir. ;)
Just curious. What are you doing with this?
the Sandman
05-05-2004, 05:21 PM
See This Thread (http://www.vbulletin.com/forum/showthread.php?t=103684) at vBulletin.com. Basically, I have removed the Title field from the newreply box so that when replying to a thread users have no option to add a title to their post. Then, using the conditional you gave me, I've removed the message icon and title area of all posts after the first to clean up the postbit. Check it out in any Thread at the Admin Zone and let me know what you think. :D
Synicide
05-05-2004, 05:26 PM
Awesome! Thanks for this request Sandman! I've been looking for something like this myself! Let me see if this works now. ^_^
EDIT: Whee! Works perfectly!
Boofo
05-05-2004, 05:29 PM
See This Thread (http://www.vbulletin.com/forum/showthread.php?t=103684) at vBulletin.com. Basically, I have removed the Title field from the newreply box so that when replying to a thread users have no option to add a title to their post. Then, using the conditional you gave me, I've removed the message icon and title are of all posts after the first to clean up the postbit. Check it out in any Thread at the Admin Zone and let me know what you think. :D
With this conditional, you don't have to remove the title field from the newreply box. I haven't removed it and it works like it should. It just won't show anything for that other than the first post. I only did this conditional after my wife decided she doesn't like to use icons when she makes a thread and all of the threads she made looked wierd in the fourms lastpostby without them. And I didn't want them on any other messages than the first one in the thread. ;)
Boofo
05-05-2004, 05:31 PM
Awesome! Thanks for this request Sandman! I've been looking for something like this myself! Let me see if this works now. ^_^
EDIT: Whee! Works perfectly!
You had doubts? ;)
Synicide
05-05-2004, 05:32 PM
With this conditional, you don't have to remove the title field from the newreply box. I haven't removed it and it works like it should. It just won't show anything for that other than the first post. I only did this conditional after my wife decided she doesn't like to use icons when she makes a thread and all of the threads she made looked wierd in the fourms lastpostby without them. And I didn't want them on any other messages than the first one in the thread. ;)
I think removing the field from that template would eliminate users from trying to find their title if they typed a custom one (which some people actually take the time to do. ^_^)... but I see where you're coming from.
Boofo
05-05-2004, 05:35 PM
See This Thread (http://www.vbulletin.com/forum/showthread.php?t=103684) at vBulletin.com. Basically, I have removed the Title field from the newreply box so that when replying to a thread users have no option to add a title to their post. Then, using the conditional you gave me, I've removed the message icon and title area of all posts after the first to clean up the postbit. Check it out in any Thread at the Admin Zone and let me know what you think. :D
Looks exactly like my board, only different. ;)
Do I get some special prize over to the Admin Zone now? ;)
the Sandman
05-05-2004, 05:36 PM
With this conditional, you don't have to remove the title field from the newreply box. I haven't removed it and it works like it should. It just won't show anything for that other than the first post. I only did this conditional after my wife decided she doesn't like to use icons when she makes a thread and all of the threads she made looked wierd in the fourms lastpostby without them. And I didn't want them on any other messages than the first one in the thread. ;)That makes sense. Still, some members use the title field as their first sentence and then continue with the rest of the post in the message field. in which case their posts will be missing a sentence which could be confusing. Removing the Title field altogether prevents this from happening.
Boofo
05-05-2004, 05:40 PM
That makes sense. Still, some members use the title field as their first sentence and then continue with the rest of the post in the message field. in which case their posts will be missing a sentence which could be confusing. Removing the Title field altogether prevents this from happening.
LOL I've never had a user do that for a first part of a sentence. I would think they are missing something somewhere if they are doing that. ;)
I kept it in in case I want to add a title to a message somewhere in the thread for whatever reason. I like having the option in case I would ever need it. Maybe like a contest to see who can find where I posted what. ;)
the Sandman
05-05-2004, 05:59 PM
Do I get some special prize over to the Admin Zone now? ;)Sure, what would you like? :rolleyes:
Boofo
05-05-2004, 06:06 PM
Sure, what would you like? :rolleyes:
Just razzing you, my friend. ;)
the Sandman
05-05-2004, 06:12 PM
Just razzing you, my friend. ;)I know - that smilie :rolleyes: is "Ponder", not "Rolleyes". I could give you some perks over at TAZ... no problem. :) In fact, I just did!
Boofo
05-05-2004, 06:20 PM
I know - that smilie :rolleyes: is "Ponder", not "Rolleyes". I could give you some perks over at TAZ... no problem. :) In fact, I just did!
I want to know how you did those tabs at the top. I could use that idea real nice. ;)
I'll check out my perks. Thank you, sir. ;)
I tried to add that code to my editpost template, but it does not work. I still see the Title field in all the posts.
<!-- subject field -->
<if condition="$post['postid'] == $thread['firstpostid']">
<table cellpadding="0" cellspacing="0" border="0" style="margin-bottom:$stylevar[formspacer]px">
<tr>
<td class="smallfont" colspan="3">$vbphrase[title]:</td>
</tr>
<tr>
<td><input type="text" class="bginput" name="title" value="$title" size="50" maxlength="85" tabindex="1" title="$vbphrase[optional]" /></td>
<td> </td>
<td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
</tr>
</table>
</if>
<!-- / subject field -->
the Sandman
05-06-2004, 02:51 PM
The conditional needs to be in the postbit and postbit_legacy templates.
I tried to add that code to my editpost template, but it does not work. I still see the Title field in all the posts.
Boofo
05-06-2004, 03:50 PM
Sandman is right because $thread['firstpostid'] isn't defined in the editpost.php, only in the functions_showthread.php.
I'm confused. What exactly do I have to do then to make it so the Title field only shows up when Editing the first post?
I assumed the editpost template needed to be modified only.
the Sandman
05-07-2004, 03:51 PM
OK - I figured out how to modify the editpost template to remove the title field and message icon box when editing posts which are replies (not first posts). To do this simply use the conditional:
<if condition="$show['firstpostnote']">I put it here:
<!-- subject field -->
<if condition="$show['firstpostnote']">
<table cellpadding="0" cellspacing="0" border="0" style="margin-bottom:$stylevar[formspacer]px">
<tr>
<td class="smallfont" colspan="3">$vbphrase[title]:</td>
</tr>
<tr><td><input type="text" class="bginput" name="title" value="$title" size="50" maxlength="85" tabindex="1" title="$vbphrase[optional]" /></td>
<td> </td>
<td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
</tr>
</table>
</if>
<!-- / subject field -->
And here:
<if condition="$show['firstpostnote']">
$posticons
</if>
Works like a champ!
Thank you Sandman! Now it works perfect. :)
FragMasterB
08-09-2004, 08:47 PM
Works like a charm fellas! Thanks. Exactly what I needed. I noticed that a "Preview" still has the Subject field in it tho... not a big deal... just thought I'd mention it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.