vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How do I include $threadinfo in the headinclude template? (https://vborg.vbsupport.ru/showthread.php?t=327425)

ice9 08-01-2019 11:30 PM

How do I include $threadinfo in the headinclude template?
 
What do I need to do to include $threadinfo['replycount'] in my headinclude template?

I'm running header bidding, and I want to only include calls to certain ads if there are 0 replies, 1 reply, or more than 1 reply. Currently, inserting $threadinfo['replycount'] in my headinclude template doesn't return anything.

scottkoz20 08-02-2019 12:11 PM

what is this going to do for you?

Would it be beneficial to look at having dynamic slots based on the number of posts using plug-ins?

This would allow you to have multiple slots... I have mine after post 3, 5, 7 and the last post of the page (default is 10 per page).


hook location - postbit_display_complete

Code:

global $ids;

$excluded = 88; // my VIP usergroup for no showing ads

if (!is_member_of($vbulletin->userinfo, $excluded) AND $post['postid'] == $ids[post_number] AND THIS_SCRIPT !== 'private')
{
    $template_hook['postbit_end'] .= '
<CENTER>
    AD CODE HERE
</CENTER>';
}


I'm sure someone that is better than me can probably array the $ids for the posts to have 1 plug in as opposed to multiples....

credit to MarkFL for helping me initially with mine.

Scott

ice9 08-09-2019 02:22 PM

I think I'll be able to do this all in the SHOWTHREAD template. With header bidding, you need to first make a bidding call in the header, for every ad that will be shown on the page. So, for example, if a thread has 0 responses, you shouldn't make header calls for ads that show after post #2.

I believe the modulo operation in a conditional statement can do this best, at the top of SHOWTHREAD. So, since I show ads in the 1st and 2nd posts on a page (post #1, post #2, post #11, post #12, etc.), it will look something like this:

Code:

<vb:if condition="$thread['replycount'] % $perpage == 0">
MAKE HEADER CALLS FOR 1ST POST ADS ONLY
<vb:else>
MAKE HEADER CALLS FOR 1ST AND 2ND POST ADS
</vb:if>

Let me know if that looks good.


All times are GMT. The time now is 07:12 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.01100 seconds
  • Memory Usage 1,711KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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