PDA

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


Moparx
29 Jan 2006, 03:45
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
29 Jan 2006, 12:03
Bingo! I've been waiting for this. Thank you very much, Moparx. :)

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

Moparx
29 Jan 2006, 14:43
change:
!$GLOBALS['FIRSTPOSTID']

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

bigmonay2k
31 Jan 2006, 04:04
screenshot?

Moparx
31 Jan 2006, 04:57
screenshot?

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

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

Akagi
02 Feb 2006, 08:33
thank you! this work fine!

hiiped
03 Feb 2006, 22:54
very useful

thanks

Sean James
04 Feb 2006, 10:46
I get a white blank page after i post, how do i fix this?

Snake
04 Feb 2006, 12:14
Be sure you've placed the ads code correctly.

Sean James
04 Feb 2006, 20:26
Be sure you've placed the ads code correctly.

yes i am sure ;)

CB88
18 Feb 2006, 17:43
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
18 Feb 2006, 18:16
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
19 Feb 2006, 01:37
Tried that and it still does not work, used the number 3 instead of "x"...any suggestions?

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

Gallio
19 Feb 2006, 09:14
Do you have a preview? :D

CB88
20 Feb 2006, 22:06
Yep...dunno what te problem is

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

Mr Chad
27 May 2006, 08:30
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
27 May 2006, 09:28
hmm, it looks like if you have two pages and its under the X post and you reply to it, it messed up.

Ahsin1
27 May 2006, 16:48
Hello,

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

peter_s
03 Jul 2006, 20:45
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
03 Jul 2006, 21:30
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
04 Jul 2006, 01:11
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
21 Jul 2006, 02:32
Code did not work for me. Third hack on Vb.org that involves adsense that does not work.

Moparx
21 Jul 2006, 03:25
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: http://www.vbulletin.org/forum/showpost.php?p=1021620&postcount=24