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)
-   -   Show Ads After post number "x" and "x" (https://vborg.vbsupport.ru/showthread.php?t=101151)

mcyates 11-18-2005 10:00 PM

Show Ads After post number "x" and "x"
 
This is a very simple template modification have similar to adsence hack and the random postbit advert hack. But you have more control with this hack as you change the option for where the adverts will appear "after which message"

Add This code to the bottom of your postbit template.

Here is the code:

Code:

<if condition="$post[postcount]==1">
<p align="center">

[AD CODE GOES HERE]

</p>
</if>

The above code would show an ad after the first post on every thread. Change this number to show the advert under a different post. Or use loads together like this:

Code:

<if condition="$post[postcount]==1">
<p align="center">

[AD CODE GOES HERE]

</p>
</if>

<if condition="$post[postcount]==10">
<p align="center">

[AD CODE GOES HERE]

</p>
</if>

<if condition="$post[postcount]==20">
<p align="center">

[AD CODE GOES HERE]

</p>
</if>

The above will show adverts after the 1st, 10th and 20th post in every thread.

Also there is another way for doing this:

Code:

<if condition="in_array($post['postcount'], array(1, 5, 10, 15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100))">
<if condition="in_array($bbuserinfo['usergroupid'], array(1, 2, 3, 4,5,6,7,8, 9))">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links (<a href=/payments.php>No Ads</a>)</td>
</tr>
<tr>
        <td class="alt1" align="center">

[AD CODE GOES HERE]

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

</div>
$spacer_close

</if></if>


Slapyo 11-19-2005 03:08 PM

You could combine them all into one.

Code:

<if condition="$post[postcount]==1 OR $post[postcount]==10 OR $post[postcount]==20">
<p align="center">

[AD CODE GOES HERE]

</p>
</if>


mcyates 11-19-2005 05:13 PM

yeah, thanks for that. But i've got different codes for each one. that would be fine for 1 standard adverts of the same.

Tony G 11-19-2005 11:36 PM

Thanks for sharing. Could you please put your instructions in a .txt file and attach it also? Thanks.

Snake 11-21-2005 11:28 AM

Thanks man.

manguish 11-26-2005 06:54 PM

This works better for me :

Code:

<if condition="$post[postcount] == 1">
<if condition="in_array($bbuserinfo['usergroupid'], array(1, 2, 3, 4, 8, 9, 10, 22, 6))">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links</td>
</tr>
<tr>
        <td class="alt1" align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-8986773341913936";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "8B1306";
google_color_bg = "132C4B";
google_color_link = "FFFFFF";
google_color_url = "FFFF00";
google_color_text = "FFFFFF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
        </td>
</tr>
</table>

</div>
$spacer_close

</if></if>


wolfstream 12-13-2005 12:15 AM

Yet another way to do this:
Code:

<if condition="in_array($post['postcount'], array(1, 5, 10, 15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100))">
<if condition="in_array($bbuserinfo['usergroupid'], array(1, 2, 3, 4,5,6,7,8, 9))">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links (<a href=/payments.php>No Ads</a>)</td>
</tr>
<tr>
        <td class="alt1" align="center">
<script type="text/javascript"><!--
google_ad_client = "your google Stuff Here!";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "89959B";
google_color_bg = "BEC8CE";
google_color_link = "000000";
google_color_url = "00008B";
google_color_text = "496690";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
        </td>
</tr>
</table>

</div>
$spacer_close

</if></if>

This will do as above, placing an ad every 5 posts (up to 100). To exclude groups or raise the post limits, just change the first two arrays :)

Enjoy

Lapsetur 12-25-2005 09:52 AM

It did not work in postbit template so put it into postbit_legacy and works fine

Lapsetur 12-29-2005 10:57 AM

Quote:

Originally Posted by wolfstream
Yet another way to do this:
Code:

<if condition="in_array($post['postcount'], array(1, 5, 10, 15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100))">
<if condition="in_array($bbuserinfo['usergroupid'], array(1, 2, 3, 4,5,6,7,8, 9))">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Sponsored Links (<a href=/payments.php>No Ads</a>)</td>
</tr>
<tr>
        <td class="alt1" align="center">
<script type="text/javascript"><!--
google_ad_client = "your google Stuff Here!";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "89959B";
google_color_bg = "BEC8CE";
google_color_link = "000000";
google_color_url = "00008B";
google_color_text = "496690";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
        </td>
</tr>
</table>

</div>
$spacer_close

</if></if>

This will do as above, placing an ad every 5 posts (up to 100). To exclude groups or raise the post limits, just change the first two arrays :)

Enjoy


I installed also this but adsense does not show

wolfstream 12-29-2005 11:51 AM

works fine here, make sure you're in one of the usergroups that actually shows this, and it should work fine.
Also, make sure that you replace all the google stuff with your own google code and settings, that could be part of it as well.

I've been running like this for a while, had no problems with it at all :)

ahmed-samara 12-29-2005 12:28 PM

Thanks man.

Lapsetur 12-29-2005 01:17 PM

Sometimes it shows sometimes not I couldn't figure out

wolfstream 12-29-2005 01:44 PM

Quote:

Originally Posted by Lapsetur
Sometimes it shows sometimes not I couldn't figure out

If it's "randomly" not working, then most likely it's not the code at all, but communication with adsense. This happens occasionally.

Lapsetur 12-29-2005 01:47 PM

Well the code did not work with postbit but work on postbit_legacy. Why this happens also?

Lapsetur 12-29-2005 01:50 PM

I also put an adsense code to header and it work fine but in ipostbit_legacy I am having problem

nishv 10-13-2006 12:45 AM

Rather than doing that, how about adding a code to show every X post...

The Following will work with vB 3.6.1

Code:

<if condition="$post[postcount] % X == 0">
Replace X with the Number.

Camz 01-15-2007 05:59 PM

Can i use this hack on posbit?

mcyates 02-03-2007 08:13 AM

yes, just put it at the bottom of that template and it will work in exactly the same way.

mcyates 06-18-2007 10:42 AM

Quote:

Originally Posted by Lapsetur (Post 859527)
Well the code did not work with postbit but work on postbit_legacy. Why this happens also?

It should work properly. Sometimes if you have google adverts above this code then google stop showing them. Google only allow so many ads on the page, 2 or 3 I think.


All times are GMT. The time now is 04:55 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.01392 seconds
  • Memory Usage 1,768KB
  • 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
  • (8)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)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