vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - A Neater Google Adsense After First Post (https://vborg.vbsupport.ru/showthread.php?t=241944)

RichieBoy67 02-20-2014 05:02 PM

Quote:

Originally Posted by Vintum (Post 2476076)
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.

ramesh_umk3 02-21-2014 11:50 AM

Quote:

Originally Posted by rgvtruck (Post 2398332)
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

MYU 03-16-2014 05:40 PM

Quote:

Originally Posted by ramesh_umk3 (Post 2482849)
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?

ramesh_umk3 03-17-2014 08:29 PM

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,

NAZIA 04-14-2014 03:36 AM

cool idea. it works for me..
thanks

409industries 05-28-2014 04:12 PM

Quote:

Originally Posted by RichieBoy67 (Post 2482694)
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?

tbworld 05-28-2014 06:26 PM

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. :)

409industries 05-29-2014 03:53 PM

Quote:

Originally Posted by tbworld (Post 2499823)
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.

tbworld 05-29-2014 05:18 PM

Quote:

Originally Posted by 409industries (Post 2499967)
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.

tbworld 05-29-2014 05:23 PM

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.


All times are GMT. The time now is 01:47 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.01264 seconds
  • Memory Usage 1,776KB
  • 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_html_printable
  • (6)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete