vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=155)
-   -   Adsense after first post ONLY if there are more than X posts in the thread (https://vborg.vbsupport.ru/showthread.php?t=106596)

Moparx 01-28-2006 10:00 PM

Adsense after first post ONLY if there are more than X posts in the thread
 
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:
PHP Code:

<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:
PHP Code:

!$GLOBALS['FIRSTPOSTID'

to:
PHP Code:

$post[postcount] % $vboptions[maxposts] == 


bigmonay2k 01-31-2006 03:04 AM

screenshot?

Moparx 01-31-2006 03:57 AM

Quote:

Originally Posted by bigmonay2k
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

Quote:

Originally Posted by Aftermath
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..

Quote:

Originally Posted by Griffin80
I get a white blank page after i post, how do i fix this?

You are using your quick reply right?
Try changing:
PHP Code:

!$GLOBALS['FIRSTPOSTID'

To this:
PHP Code:

$post[postcount] % $vboptions[maxposts] == 


Quote:

Originally Posted by CB88
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

Quote:

Originally Posted by CB88
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
Code:

<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
Code:

<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

Quote:

Originally Posted by peter_s
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

Quote:

Originally Posted by Moparx
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

Quote:

Originally Posted by peter_s
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)
Quote:

Originally Posted by ReadOrDie
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....0&postcount=24


All times are GMT. The time now is 02:54 AM.

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.01211 seconds
  • Memory Usage 1,795KB
  • 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
  • (5)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (27)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