PDA

View Full Version : Adsense after first post ONLY if there are more than X posts in the thread


Moparx
01-28-2006, 10:00 PM
Many forums use three ad units in their threads.. at the top, within the content, and then at the bottom. This mod was made with this kind of set up in mind.
The problem is the thread pages can tend to look horrible and overrun with ads if there is not enough content (say only a couple one line posts) between the ad units.

This isnt for everyone as some people prefer to keep all their ads showing no matter what.. but for those interested, this template modification only displays adsense after first post if there are over X amount of posts in the thread.

If you want everyone to see the ads you can remove the is_member_of AND line. Otherwise, you can add the user groups who you want to see the ads to it. (Don't forget to replace 'X' with a numerical value of your choice)


Place the following at the very end of the postbit template:
<if condition="is_member_of($bbuserinfo, 1,2) AND !$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= X">
$spacer_open

<div class="page" style="width:100%; text-align:left">
<div style="padding:0px 0px 6px 0px">

<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<tr>
<td class="alt1">

<div align="center">
<!-- adsense goes here -->
</div>

</td>
</tr>
</table>

</div>
</div>

$spacer_close
</if>

Snake
01-29-2006, 11:03 AM
Bingo! I've been waiting for this. Thank you very much, Moparx. :)

Snake
01-29-2006, 11:53 AM
One thing, I would like to show my ads AFTER the post #5. How do I do that?

Moparx
01-29-2006, 01:43 PM
change:
!$GLOBALS['FIRSTPOSTID']

to:
$post[postcount] % $vboptions[maxposts] == 5

bigmonay2k
01-31-2006, 03:04 AM
screenshot?

Moparx
01-31-2006, 03:57 AM
screenshot?

are you serious?
it displays an ad after the first post

Cal813
02-01-2006, 04:56 AM
how about for forum display? Is there a way I could place it after certain amount of threads?

Akagi
02-02-2006, 07:33 AM
thank you! this work fine!

hiiped
02-03-2006, 09:54 PM
very useful

thanks

Sean James
02-04-2006, 09:46 AM
I get a white blank page after i post, how do i fix this?

Snake
02-04-2006, 11:14 AM
Be sure you've placed the ads code correctly.

Sean James
02-04-2006, 07:26 PM
Be sure you've placed the ads code correctly.

yes i am sure ;)

CB88
02-18-2006, 04:43 PM
I've tried everything but can't get this to work, here is what I have been using:

<if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) AND !$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= X">
$spacer_open

<div class="page" style="width:100%; text-align:left">
<div style="padding:0px 0px 6px 0px">

<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<tr>
<td class="alt1">

<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-0348024283260953";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
google_ad_channel ="";
//</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> -->
</div>

</td>
</tr>
</table>

</div>
</div>

$spacer_close
</if>

Please let me know if anything is incorrect

Moparx
02-18-2006, 05:16 PM
Very sorry for the late responce..

I get a white blank page after i post, how do i fix this?
You are using your quick reply right?
Try changing:
!$GLOBALS['FIRSTPOSTID']
To this:
$post[postcount] % $vboptions[maxposts] == 1


I've tried everything but can't get this to work, here is what I have been using:

<if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) AND !$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= X">
Change X to a numerical value of your choice (like 3 or 4)

CB88
02-19-2006, 12:37 AM
Tried that and it still does not work, used the number 3 instead of "x"...any suggestions?

Moparx
02-19-2006, 02:33 AM
it should be working fine for you then... it is definately added in the postbit template right?

Gallio
02-19-2006, 08:14 AM
Do you have a preview? :D

CB88
02-20-2006, 09:06 PM
Yep...dunno what te problem is

shadowdancer36
03-15-2006, 03:07 AM
I can't get this to show up for some reason. Is it compat with the newest ver of VB?

Mr Chad
05-27-2006, 07:30 AM
I've tried everything but can't get this to work, here is what I have been using:

<if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) AND !$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= X">
$spacer_open

<div class="page" style="width:100%; text-align:left">
<div style="padding:0px 0px 6px 0px">

<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<tr>
<td class="alt1">

<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-0348024283260953";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
google_ad_channel ="";
//</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> -->
</div>

</td>
</tr>
</table>

</div>
</div>

$spacer_close
</if>

Please let me know if anything is incorrect
lol... thats dumb...

replace your <if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) AND !$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= X">

With
<if condition="!$GLOBALS['FIRSTPOSTID'] AND $GLOBALS[threadinfo][replycount] >= 3">

You dont need to list every user group if you want it to show to everyone...

Mr Chad
05-27-2006, 08:28 AM
hmm, it looks like if you have two pages and its under the X post and you reply to it, it messed up.

Ahsin1
05-27-2006, 03:48 PM
Hello,

I want to make it after x no of replies any idea

peter_s
07-03-2006, 07:45 PM
I added this mod to my VB 3.5.4 but nothing shows up. I only added the code to postbit template? Do I have to add it to any other templates as well? Does it take time for the change to take place? I assume I should be able to see the result instantly!

Moparx
07-03-2006, 08:30 PM
I added this mod to my VB 3.5.4 but nothing shows up. I only added the code to postbit template? Do I have to add it to any other templates as well? Does it take time for the change to take place? I assume I should be able to see the result instantly!
did you update the conditional so it shows in the user group you are trying to view it as? also are you using an ad blocker?

peter_s
07-04-2006, 12:11 AM
did you update the conditional so it shows in the user group you are trying to view it as? also are you using an ad blocker?

How do I update conditional?

I dont have an ad blocker. I can see adsense on other pages just fine.

ReadOrDie
07-21-2006, 01:32 AM
Code did not work for me. Third hack on Vb.org that involves adsense that does not work.

Moparx
07-21-2006, 02:25 AM
How do I update conditional?

I dont have an ad blocker. I can see adsense on other pages just fine.
is_member_of($bbuserinfo, 1,2)
Code did not work for me. Third hack on Vb.org that involves adsense that does not work.
If you are going to post then make an attempt at asking for help and show your code as you most likely did it wrong since the code works perfect on the entire 3.5.x series. Just complaning about it is a waste of both of our time since I cant see what you are doing

Refer to and respond to this post.. include your version of vbulletin as well: https://vborg.vbsupport.ru/showpost.php?p=1021620&postcount=24