vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Conditional for after first post of a thread (https://vborg.vbsupport.ru/showthread.php?t=255018)

skor 12-10-2010 05:06 PM

Conditional for after first post of a thread
 
I am trying to put some text only after the first post in a thread for a specific forum . I've tried...

<if condition="$forum['forumid'] == 24 AND !$GLOBALS['FIRSTPOSTID']">text here</if>

the only issue I am having is that it's appearing after the first post on every page for a thread that has multiple pages.

is there a conditional that would include it only after the first post of the whole thread so that it wouldn't show on the 2nd page?

thank you

calorie 12-10-2010 05:08 PM

How about including page number as part of the condition?

skor 12-10-2010 05:17 PM

Hi thank you for the reply.

I tried...

<if condition="$forum['forumid'] == 24 AND !$GLOBALS['FIRSTPOSTID'] AND $pagenumber == 1"> but that didn't seem to work. Nothing showed up on any of the pages.

wasn't sure if it's because I am not allowed to use multiple AND's?

kh99 12-10-2010 05:30 PM

I just looked at that because someone asked something similar a couple days ago. If you are putting your "if" condition in a postbit template, I don't think the page number is available, but you could use a plugin to make it available if you wanted.

skor 12-10-2010 05:36 PM

I found this

https://vborg.vbsupport.ru/showthread.php?t=208945&highlight=$pagenumber

but does anyone know if that solution would cause any sort of additional db queries?

Do you know which plugin that is?

kh99 12-10-2010 05:38 PM

That's the same kind of thing I was talking about except editing the file instead of a plugin.

No, it won't add any db queries.

ETA: postbit_display_complete should work - of course you'd have to add a separate "global" line instead of adding to the existing one.

skor 12-10-2010 05:55 PM

Quote:

Originally Posted by kh99 (Post 2131979)

ETA: postbit_display_complete should work - of course you'd have to add a separate "global" line instead of adding to the existing one.

Thank you. I'm kind of lost on what you mean by this?

Is postbit_display_complete a template? Couldn't find it in the templates or in the php files?

And would I add something like

global $pagenumber; to the top of this file?

Sorry for my igorance...pretty much know how to search for things but not much else...

kh99 12-10-2010 05:57 PM

No, I'm sorry I assumed you would know what I meant.

postbit_display_complete is a hook location, so you could create a new plugin and select that hook location and for the code use "global $pagenumber;" (you need a title so you'll remember what it is, and you need to select the "Yes" radio button on the bottom to activate it, but the other fields don't matter).

You could also edit the class_post.php file like that post suggests if you want, but I think it's easier to manage upgrades if you avoid editing your php files.

skor 12-10-2010 05:58 PM

Thank you very much! :)

calorie 12-10-2010 06:02 PM

Are you editing the postbit template? How about something like this at the end of the postbit template instead?
Code:

<if condition="$post[postcount] == 1">
        <div style="padding-top:5px">
                text here
        </div>
</if>



All times are GMT. The time now is 06:28 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.01511 seconds
  • Memory Usage 1,727KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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