Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Adsense as second post. 2 Sizes - Big for guests, small for members - Legacy Version Details »»
Adsense as second post. 2 Sizes - Big for guests, small for members - Legacy Version
Version: 1.15, by StarBuG StarBuG is offline
Developer Last Online: Nov 2022 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.6.7 Rating:
Released: 02-10-2007 Last Update: 07-21-2007 Installs: 84
Template Edits
 
No support by the author.

Hi

I made this template mod for my medical Forum and I decided to share this with you

This hack is for forums that use the Postbit_legacy Template

If you use the standard postbit template >> click here <<


What this hack does:
This modification displays adsense as second post in every thread.
Guest see a post like adsense with a product Referral (firefox in this code) and a leaderboard as post content. Registered Members see a standard banner so they don't get annoyed by the big advertising. I also included an information for guests, that they see a different not so disturbing ad if they register. This serves to purposes, one is to get more members to register of course the second purpose is to blend the advertising better into the post layout.

ADD-ON:
In addition you can add a Google Adsense link unit as last post of a thread on any page for members and guests. This advertising will only show if the thread has more then one post so that it does not show 2 advertisings directly below each other in case that the thread has no replies yet. Google Adsense has updated its ToS so that you are now allowed to use up to three link units on one page. So if you already use my "Adsense Link Unit in Navbar" Mod there woun't be a problem.


See screenshots

How to install:


In template postbit (legacy version) search:


Code:
<if condition="$post['userid'] AND $show['member']">
    <tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
    </if>
    </table>
</div>
Add below:


Code:
<!-- Google AdSense in Posts for Guests -->
<if condition="THIS_SCRIPT == 'showthread' AND !$GLOBALS['FIRSTPOSTID'] AND (!$show[member])">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
</if>

<!-- BEGIN TEMPLATE: postbit -->
<table id="post$post[postid]" class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center">
<tbody>
 <tr>
  <td class="thead" style="font-weight:normal; border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-right: 0px" $post[scrolltothis]>        
            <!-- status icon and date -->
            <img title="Alt" class="inlineimg" src="images/statusicon/post_old.gif" alt="Alt" border="0"> Today
            <!-- / status icon and date -->                
    </td>
    <td class="thead" style="font-weight:normal; border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-left: 0px" align="$stylevar[right]">
    </td>
 </tr>
 <tr valign="top">
    <td class="alt2" width="175" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px; border-bottom: 0px">
            <div id="postmenu_$post[postid]">
                <span class="bigusername"><u><font color="#373737">Advertising</font></u></span>
                <br><br>
                <!-- Adsense Referral Code start -->
        <script type="text/javascript"><!--
        google_ad_client = "YOUR PUB ID HERE";
        google_ad_width = 125;
        google_ad_height = 125;
        google_ad_format = "125x125_as_rimg";
        google_cpa_choice = "CAAQ0f2XhAIaCA6IC4oIlz0_KK2293M";
        //--></script>
        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
       <!-- Adsense Referral Code end-->
            </div>
    </td>
    <td class="alt1" id="td_post_$post[postid]" style="border-right: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]">
  <!-- icon and title -->
            <div class="smallfont">
                <img title="Post" class="inlineimg" src="images/icons/icon1.gif" alt="Beitrag" border="0">
                <strong>Sponsored Links</strong>
            </div>
            <hr size="1" style="color:$stylevar[tborder_bgcolor]" />
            <!-- / icon and title -->
        <!-- message -->
        <div>
         <!-- Adsense leaderboard start -->
         <script type="text/javascript"><!--
         google_ad_client = "YOUR PUB ID HERE";
         google_ad_width = 728;
         google_ad_height = 90;
         google_ad_format = "728x90_as";
         google_ad_type = "text";
         //--></script>
         <script type="text/javascript"
           src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
         </script>
    <!-- Adsense leaderboard end -->
        </div>
        <!-- / message -->
        <!-- sig -->
            <div>__________________<br>
                <i>This advertising will not be shown in this way to registered members.<br />
                   <a href="register.php">Register</a> your free account today and become a member on $vboptions[bbtitle]</i>
            </div>
        <!-- / sig -->
    </div>
        <!-- / message -->
    </td>
</tr>
<tr>
    <td class="alt2" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px">
      &nbsp;
    </td>
    <td class="alt1" align="$stylevar[right]" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-left: 0px; border-top: 0px">
   &nbsp;
    </td>
</tr>
</tbody></table>
<!-- / post $post[postid] popup menu -->
</if>
<!-- / Google AdSense in Posts for Guests-->

<!-- Google AdSense in Posts for Members -->
<if condition="THIS_SCRIPT == 'showthread' AND !$GLOBALS['FIRSTPOSTID'] AND ($show[member])">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>    
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="td_post_$post[postid]">
   <div class="normal">
        &nbsp;
     </div>
    </td>
</tr>
<tr>
    <td class="alt1" align="center">
        <div>
    <!-- Adsense standard banner start -->
      <script type="text/javascript"><!--
      google_ad_client = "YOUR PUB ID HERE";
      google_ad_width = 468;
      google_ad_height = 60;
      google_ad_format = "468x60_as";
      google_ad_type = "text";
      //--></script>
      <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
     <!-- Adsense standard banner End -->
        </div>
    </td>
</tr>
</tbody>
</table>
</if>
<!-- / Google AdSense in Posts for Members-->
ADD-ON:


Add this code below the last line of my above code:


Code:
<!-- Google AdSense Link unit as last post for all -->
<if condition="THIS_SCRIPT == 'showthread' AND $post['islastshown'] and !$GLOBALS['vbulletin']->GPC['ajax'] AND $post[postcount]!=1">

<if condition="$show['spacer']">
    </div>
    $spacer_close
</if>

<if condition="$show['spacer']">
    $spacer_open
    <div id="edit$post[postid]" style="padding:0px 0px $stylevar[cellpadding]px 0px">
    <if condition="!$post['islastshown']"><!-- this is not the last post shown on the page --></if>    
</if>

<table class="tborder" id="post$post[postid]" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody><tr>
    <td class="thead" id="td_post_$post[postid]">
   <div class="normal">
        &nbsp;
     </div>
    </td>
</tr>
<tr>
    <td class="alt1" align="center">
        <div>
         <!-- Adsense Link Unit start -->
         <script type="text/javascript"><!--
         google_ad_client = "YOUR PUB ID HERE";
         google_alternate_color = "F5F5FF";
         google_ad_width = 728;
         google_ad_height = 15;
         google_ad_format = "728x15_0ads_al_s";
         google_color_border = "F5F5FF";
         google_color_bg = "F5F5FF";
         google_color_link = "000000";
         google_color_text = "000000";
         google_color_url = "000000";
         //-->
         </script>
         <script type="text/javascript"
           src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
         </script>
         <!-- Adsense Link Unit end -->
        </div>
    </td>
</tr>
</tbody>
</table>
</if>
<!-- Google AdSense Link unit as last post for all -->
You now just need to customize the adsense code marked with:
<!-- Adsense Referal Code start -->
<!-- Adsense large rectangle start -->
<!-- Adsense standard banner start -->


Add-on:
<!-- Adsense Link Unit start -->

replace "YOUR PUB ID HERE" with your pub-ID
and fit the colors of adsense to your color scheme


Demo: Elternfragen.net - Das Forum f?r Eltern mit (medizinischen) Fragen

Just go into any thread.


I hope you like it and if you do, don't forget to mark es installed


Changelog:
v1.15 - 2007/07/22: NO CHANGES, just removed my Pub-ID from the hack!
v1.15 - 2007/06/11: Add-on - Google Adsense Link unit as last post of every thread for guests and members.
v1.1 - 2007/05/06: Condition altered to show advertising as second post on every page, not just the first.
v1.0 - 2007/03/01: Changed a few German phrases to English, removed an unneccessary condition


If you want more good placements for adsense code, check out my newest mod:


Adsense Link Unit in Navbar


StarBuG

If you did not register for an Adsense account yet but you plan to, feel free to contact me. If you register via my referral I am willing to help you get the most out of your adsense placement by assisting you during the setup process and implementing the best adsense modifications. Just write me a Private message.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 09-15-2007, 03:56 PM
Kaelon's Avatar
Kaelon Kaelon is offline
 
Join Date: Jan 2002
Posts: 405
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by StarBuG View Post
Yes, there are lots of Referral Images in all sizes and for numerous products.
I did not made the FF banner myself

What do you mean by "google_cpa_choice parameter"?
Rather, that the google_cpa_choice in the referral image was what brought up the Firefox image. I wanted to select a different image. Is that possible? Or was Google simply cycling them around?
Reply With Quote
  #43  
Old 09-17-2007, 04:29 PM
hrk hrk is offline
 
Join Date: May 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi. how do i see mine is posbit or legacy template?

thanks,
Reply With Quote
  #44  
Old 09-18-2007, 02:38 PM
StarBuG's Avatar
StarBuG StarBuG is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 1,033
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

legacy is where the user info is on the left of the post, in normal postbit the user info is on top of the post.
Reply With Quote
  #45  
Old 09-25-2007, 04:03 PM
hrk hrk is offline
 
Join Date: May 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by StarBuG View Post
legacy is where the user info is on the left of the post, in normal postbit the user info is on top of the post.
thanks mate!
Reply With Quote
  #46  
Old 12-13-2007, 08:09 AM
mark|3 mark|3 is offline
 
Join Date: Oct 2007
Posts: 186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi starbug

here's is my site. Possible to guide me on how to go about changing the background color of the advert.

Thanks
Reply With Quote
  #47  
Old 12-13-2007, 09:49 AM
StarBuG's Avatar
StarBuG StarBuG is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 1,033
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The color code for the adsense Ads is in the Google Code itself:

Go to your Adsense Setup and create the Banner you want, there you'll find all the options for changing the colors. Replace the current code with the newly generated code and you are good to go.

Ah, one more thing.
You use a leaderbord Banner inside the Navigation, that is not a good choice.

Put it below the navigation and inside the link unit like in my hack you seem to use.
Much better results.

To add a leaderboard banner below the navigation

In the navbar Template search for:

Code:
<!-- / PAGENAV POPUP -->
</if>
and add below:

Code:
<!-- 728x90 Leaderboard below navigation-->
<if condition="THIS_SCRIPT != 'index'">
<table class="tborder" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
<tbody>
 <!-- <tr>
  <td class="tcat" align="center"></td>
 </tr> -->
 <tr>
  <td class="alt1" colspan="2">
   <span class="smallfont">
   <center> 
YOUR ADSENSE LEADERBOARD CODE HERE
   </center>
   </span>
  </td>
 </tr>
</tbody>
</table><br />
</if>
<!-- 728x90 Leaderboard below navigation -->
StarBuG
Reply With Quote
  #48  
Old 12-13-2007, 02:01 PM
McCarroll21 McCarroll21 is offline
 
Join Date: Sep 2006
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My question is probably a simple one; though I'm not really sure. I really think I'm just overlooking something, but can't find what it is I'm looking over.

I have tested this time and time again and can't get it to show how I want it. I want to do the after first post AND after the last post. I want it to show for everyone (members and guests alike). My problem is that I get it to show, but if I have a thread that only has one post showing on one page (let's say it has 31 posts in it, so on page 4 it only has one post) I get both boxes showing up when I only want it to show one.

How could this condition be modified to where it will not show if there is only one post on the current page? I know it has if the thread only has one post, but what about one post on the current page?
Code:
<if condition="THIS_SCRIPT == 'showthread' AND $post['islastshown'] and !$GLOBALS['vbulletin']->GPC['ajax'] AND $post[postcount]!=1">
Thanks!
Reply With Quote
  #49  
Old 12-13-2007, 09:41 PM
StarBuG's Avatar
StarBuG StarBuG is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 1,033
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could add AND $post[postcount]!=31 at the end of the condition.

But this is not an elegant solution.

I have no idea how to solve this issue because the page break depends on your settings.
I think you should ask in the programmers forum here on vB.org, if someone knows a solution.
Reply With Quote
  #50  
Old 12-14-2007, 05:37 PM
mark|3 mark|3 is offline
 
Join Date: Oct 2007
Posts: 186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the solution
but now i have another problem bec there's a space between the banner. Any idea on how to prevent the gap between the navbar and the advert?

Thanks
Reply With Quote
  #51  
Old 12-14-2007, 07:32 PM
StarBuG's Avatar
StarBuG StarBuG is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 1,033
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would leave the break between the navbar and the banner, that is a much cleaner display.

However, if not, check in the navbar template above the search code, there must be a <br /> that you need to remove
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05076 seconds
  • Memory Usage 2,336KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete