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


All times are GMT. The time now is 11:06 AM.

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.01497 seconds
  • Memory Usage 1,745KB
  • 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
  • (1)bbcode_code_printable
  • (5)bbcode_html_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete