PDA

View Full Version : How do I include $threadinfo in the headinclude template?


ice9
08-01-2019, 11:30 PM
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


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:


<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.