Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
A Neater Google Adsense After First Post Details »»
A Neater Google Adsense After First Post
Version: 1.00, by ShawneyJ ShawneyJ is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.0.5 Rating:
Released: 05-05-2010 Last Update: Never Installs: 190
Template Edits
Re-useable Code Translations  
No support by the author.

Ok, so i haven't found any google adsence products for vb 4 yet that sit neatly under your first post only, on every page. Credits to Miko and my self for a few tiny edits.

How To Install
Step.1:
GoTo Postbit Templates>>open postbit_legacy and add at the very bottom:

Code:
<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
      REPLACE THIS WITH YOUR ADSENSE CODE HERE
</div>
</li>
</vb:if>

Step.2:
GoTo CSS Templates>>open additional.css and add this code:

Code:
.firstpost_advert_container {
    clear: both;
    display: block;
    float: left;
    margin-bottom: 12px;
    position: relative;
    width: 100%;
    border: 1px solid #E5E6F4;
}

.firstpost_advert {
    with: 100%;
    background: #F1F1FA;
    border: 1px solid #fff;
    min-height: 90px;
    margin: 0;
    padding: 7px;
    text-align: center;
    vertical-align: middle;
}
Feel free to customize to your needs, i had to mess around to suit my custom style. I changed the min-height to 90px for a neater look for 728x90 ads and changed margin-bottom: to 18px. But how the code is above is perfect for Vbulletin 4 Default.
DEMO: Teen Forums
Please Note: im not a coder, i just wanted to share this with others, its VERY easy to add to your styles and looks neat. Good Luck.
This coding is also different than Mod Version: 1.00, by Allan. You shouldn't have any problems with this and it will do you till a product version comes out.

Screenshots

File Type: jpg Neater Google Adsense After First Post.jpg (83.6 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
5 благодарности(ей) от:
acmalin927, farru, sodasusu, SolidSnakeLive, StormBreaker

Comments
  #72  
Old 02-20-2014, 05:02 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Vintum View Post
Is it possible to change the ads based on the forum the user is viewing using this code?
You can accomplish this with conditionals. Do a google search for examples.
Reply With Quote
Благодарность от:
409industries
  #73  
Old 02-21-2014, 11:50 AM
ramesh_umk3 ramesh_umk3 is offline
 
Join Date: Jul 2010
Location: Earth
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rgvtruck View Post
I have DBTech Post Thanks, and it seems not to be working. What else can i do?
Goto postbit_legacy template and add below code to very end of the template:

PHP Code:
<div class="postbit">
<
h3 style="color: rgb(189, 189, 189); font-weight: bold;" class="posthead">&nbsp;&nbsp;Sponsored Links</h3>

<
div align="center" style="padding:3px;" class="postbody">
YOUR 728x90 AD HERE

<p style="float:left;">

YOUR TEXT AD HERE [160x90]

</
p>

</
div>

</
div
Live Demo
Reply With Quote
  #74  
Old 03-16-2014, 05:40 PM
MYU MYU is offline
 
Join Date: Dec 2013
Location: London
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ramesh_umk3 View Post
Goto postbit_legacy template and add below code to very end of the template:

PHP Code:
<div class="postbit">
<
h3 style="color: rgb(189, 189, 189); font-weight: bold;" class="posthead">&nbsp;&nbsp;Sponsored Links</h3>

<
div align="center" style="padding:3px;" class="postbody">
YOUR 728x90 AD HERE

<p style="float:left;">

YOUR TEXT AD HERE [160x90]

</
p>

</
div>

</
div
Live Demo
That looks really good, do I need to pace another code in "CSS Templates" as it says in the first post?
Reply With Quote
  #75  
Old 03-17-2014, 08:29 PM
ramesh_umk3 ramesh_umk3 is offline
 
Join Date: Jul 2010
Location: Earth
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you want to display this only after first post right ? Just apply below template conditional

PHP Code:
<vb:if condition="$post[postcount] == 1 OR $post[postcount] % 11 == 0">

<
div class="postbit">
<
h3 style="color: rgb(189, 189, 189); font-weight: bold;" class="posthead">&nbsp;&nbsp;Sponsored Links</h3>

<
div align="center" style="padding:3px;" class="postbody">
YOUR 728x90 AD HERE

<p style="float:left;">

YOUR TEXT AD HERE [160x90]

</
p>

</
div>

</
div>

</
vb:if> 
Regards,
Reply With Quote
  #76  
Old 04-14-2014, 03:36 AM
NAZIA's Avatar
NAZIA NAZIA is offline
 
Join Date: Feb 2008
Location: Multan Pakistan
Posts: 322
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cool idea. it works for me..
thanks
Reply With Quote
  #77  
Old 05-28-2014, 04:12 PM
409industries 409industries is offline
 
Join Date: Jan 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RichieBoy67 View Post
You can fix the curly error with

<vb:literal> tag--Just surround Google script with it
Thank you for this great tip. I too get a bit annoyed with the "curly error" and this took care of the problem. I followed spinnaker's suggestion and have AdSense ads displaying after the first post AND after the last post.

Great simple mod that only requires an easy addition of code. Great work!

One last question:

If you have edited the code to display ads on threads both after the first post AND the last post... when a thread is brand new and there is ONLY one post you get two Google AdSense ads back to back. Is there a way to disable the "second" or "last" container so that it does not show an ad if there is only one post in a thread?
Reply With Quote
  #78  
Old 05-28-2014, 06:26 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this, I have not tested the code, so please let me know.

(Alter the post count ($tbworld_postbit_postcount >= 3) to what suits you.)

HTML Code:
// Revised Last Post Advert
<vb:if condition="$post['islastshown'] AND $tbworld_postbit_postcount >= 3">
<li class="lastpost_advert_container"><div class="lastpost_advert">
      REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div>
</li>
</vb:if>
Create Plugin to keep track of post counts per page.
PHP Code:
// Hook: postbit_display_complete
if (THIS_SCRIPT == 'showthread')
{
    global 
$tbworld_postbit_postcount;
    
vB_Template::preRegister('postbit_legacy',array('tbworld_postbit_postcount' => ++$tbworld_postbit_postcount));        

Should help.
Reply With Quote
  #79  
Old 05-29-2014, 03:53 PM
409industries 409industries is offline
 
Join Date: Jan 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
Try this, I have not tested the code, so please let me know.

(Alter the post count ($tbworld_postbit_postcount >= 3) to what suits you.)

HTML Code:
// Revised Last Post Advert
<vb:if condition="$post['islastshown'] AND $tbworld_postbit_postcount >= 3">
<li class="lastpost_advert_container"><div class="lastpost_advert">
      REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div>
</li>
</vb:if>
Create Plugin to keep track of post counts per page.
PHP Code:
// Hook: postbit_display_complete
if (THIS_SCRIPT == 'showthread')
{
    global 
$tbworld_postbit_postcount;
    
vB_Template::preRegister('postbit_legacy',array('tbworld_postbit_postcount' => ++$tbworld_postbit_postcount));        

Should help.
Where does the PHP code go, at the bottom of additional.css?

So far what i am seeing is that it is no longer showing the "last_post_advert" on single post threads, but it is also not showing it on ones that have 3+ posts.
Reply With Quote
  #80  
Old 05-29-2014, 05:18 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by 409industries View Post
Where does the PHP code go?
See ... Admin Control Panel --> Plugins and Products (Sidebar Menu) --> Add New Plugin.

Product: vbulletin
Hook Location: postbit_display_complete
Title: Postbit Post-Per-Page Counter <-- or whatever
Execution Order: 5

Plugin PHP Code:
PHP Code:
// Hook: postbit_display_complete 
if (THIS_SCRIPT == 'showthread'

    global 
$tbworld_postbit_postcount
    
vB_Template::preRegister('postbit_legacy',array('tbworld_postbit_postcount' => ++$tbworld_postbit_postcount));         

Plugin is Active : Yes

This is just a simple counter that counts post per page.
Reply With Quote
  #81  
Old 05-29-2014, 05:23 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So what should be happening is that in the "islastshown" conditional, I have added an additional check to see if the post count on that page is equal or greater than 3. If it is not then do not show the ad. Simple.
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 02:50 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.06011 seconds
  • Memory Usage 2,379KB
  • Queries Executed 28 (?)
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
  • (2)bbcode_code
  • (2)bbcode_html
  • (6)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (6)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete