vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   First Post Conditional (https://vborg.vbsupport.ru/showthread.php?t=64770)

the Sandman 05-05-2004 11:07 AM

First Post Conditional
 
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 11:18 AM

HTML Code:

<if condition="$FIRSTPOSTID == $post['postid']">
    <!-- this is the first post -->
<else />
    <!-- this is the second, third etc post -->
</if>


the Sandman 05-05-2004 11:48 AM

I must be screwing somethin up. Here's the part of the postbit template in question:
Code:

                          <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 12:12 PM

HTML Code:

<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 12: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 12:26 PM

Lee, shouldn't that actually be this?

HTML Code:

<if condition="$post['postid'] == $FIRSTPOSTID">

Boofo 05-05-2004 01: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:

HTML Code:

<if condition="$post['postid'] == $thread['firstpostid']">

the Sandman 05-05-2004 02:03 PM

Thanks Boofo, that's got it!
Quote:

Originally Posted by Boofo
Ok, I found the solution to your problem. This is what you need to use to find the first post in a thread:

HTML Code:

<if condition="$post['postid'] == $thread['firstpostid']">


Boofo 05-05-2004 04:14 PM

Quote:

Originally Posted by the Sandman
Thanks Boofo, that's got it!

You're very welcome, sir. ;)

Just curious. What are you doing with this?

the Sandman 05-05-2004 04:21 PM

See This Thread 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 04: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 04:29 PM

Quote:

Originally Posted by the Sandman
See This Thread 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 04:31 PM

Quote:

Originally Posted by Synicide
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 04:32 PM

Quote:

Originally Posted by Boofo
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 04:35 PM

Quote:

Originally Posted by the Sandman
See This Thread 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 04:36 PM

Quote:

Originally Posted by Boofo
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 04:40 PM

Quote:

Originally Posted by the Sandman
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 04:59 PM

Quote:

Originally Posted by Boofo
Do I get some special prize over to the Admin Zone now? ;)

Sure, what would you like? :rolleyes:

Boofo 05-05-2004 05:06 PM

Quote:

Originally Posted by the Sandman
Sure, what would you like? :rolleyes:

Just razzing you, my friend. ;)

the Sandman 05-05-2004 05:12 PM

Quote:

Originally Posted by Boofo
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 05:20 PM

Quote:

Originally Posted by the Sandman
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. ;)

Andy 05-06-2004 01:35 PM

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.

Code:

                <!-- 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>&nbsp;&nbsp;</td>
                        <td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
                </tr>
                </table>

</if>

                <!-- / subject field -->


the Sandman 05-06-2004 01:51 PM

The conditional needs to be in the postbit and postbit_legacy templates.
Quote:

Originally Posted by Andy B
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 02:50 PM

Sandman is right because $thread['firstpostid'] isn't defined in the editpost.php, only in the functions_showthread.php.

Andy 05-07-2004 03:34 AM

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 02: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:
Code:

<if condition="$show['firstpostnote']">
I put it here:
Code:


<!-- 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>&nbsp;&nbsp;</td>
<td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
</tr>
</table>
</if>
<!-- / subject field -->

And here:
Code:


<if condition="$show['firstpostnote']">
$posticons
</if>

Works like a champ!

Andy 05-07-2004 05:46 PM

Thank you Sandman! Now it works perfect. :)

FragMasterB 08-09-2004 07: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.


All times are GMT. The time now is 11:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03126 seconds
  • Memory Usage 1,817KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (5)bbcode_html_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (28)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete