Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Randomly positioned ad in between postbits in showthread Details »»
Randomly positioned ad in between postbits in showthread
Version: 1.01, by UK Jimbo UK Jimbo is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 10-09-2005 Last Update: Never Installs: 237
Uses Plugins Template Edits
 
No support by the author.

Inspired by this hack.

The ad is positioned randomly after one of the postbits. We use this for positioning adsense ads on visordown.com.

Install the attached plugin then add the following code to your postbit or postbit_legacy template:

HTML Code:
<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0">
$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">

<!-- ad code goes here -->

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

</div> 
$spacer_close 
</if>

Changelog

v1.01
Bug fix: The ad code shouldn't appear on PMs any more (template change)

Donations

Hopefully this plugin will earn you provide you with some good revenue. If you'd like to show your appreciation please donate as little or as much as you like.

Supporters / CoAuthors

Show Your Support

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

Comments
  #137  
Old 03-09-2006, 07:28 AM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the PMs Gottcha, I think that your problem is running multiple Google ads on the same page. Have a read here and try doing a search for "multiple" in the Google AdSense search section.
Reply With Quote
  #138  
Old 03-21-2006, 02:28 AM
mattyk72 mattyk72 is offline
 
Join Date: Mar 2004
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

clicking install
Reply With Quote
  #139  
Old 03-23-2006, 11:06 AM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi UK Jimbo,

I?ve got my own custom Ads showing up above the first post and under the lastpost. Any chance that your plugin could show the Ads only under the firstpost and above the lastpost ? Otherwise sometimes there would be 2 Ads showing up and that?s not nice and clean..

Guess it could be done with another conditional in
PHP Code:
<if condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0"
I need it that way, that ads delivered by this plugin only appear
  1. under the first post
  2. above the last post
  3. if the whole thread has at least 3 posts (so the plugin-ads can show up between the first and second or second and third post)


Any ideas ?
Reply With Quote
  #140  
Old 03-25-2006, 08:24 AM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marv
I need it that way, that ads delivered by this plugin only appear
  1. under the first post
  2. above the last post
  3. if the whole thread has at least 3 posts (so the plugin-ads can show up between the first and second or second and third post)
Jason,

even better would be a second one for registered users where Adsense only appears:
  1. under the first post
  2. above the last post
  3. if the whole thread has at least 5 posts (so the plugin-ads can show up without overloading the thread with ads)
  4. under the lastpost as Andreas mentioned before. The reason is clear - that?s the post most users read first and should lead to the best reveniews

Would turn this plug-in into a must-have for all AdSense and Yahoo publishers, which have already own custom ads or adservers running on their forums
Reply With Quote
  #141  
Old 03-30-2006, 01:39 PM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marv
  1. under the first post
  2. above the last post ($perpage=10)
  3. if the whole thread has at least 3 posts (so the plugin-ads can show up between the first and second or second and third post)
May be someone can help me out. I?ve tried to implement these 3 conditions that way_

PHP Code:
<!-- RandomAds for unregistered users -->
<if 
condition="is_member_of($bbuserinfo, 1) AND $GLOBALS[threadinfo][replycount] >= 3">
<if 
condition="$post['postid'] > '1' AND $post['postid'] <> '10' AND $post['postid'] <> '20' AND $post['postid'] <> '30' AND $post['postid'] <> '40' AND $post['postid'] <> '50' AND $post['postid'] <> '60' AND $post['postid'] <> '70' AND $post['postid'] <> '80' AND $post['postid'] <> '90'">
<if 
condition="$GLOBALS['adsense_position'] == $post['postcount'] && $GLOBALS['adsense_position'] > 0">
$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="alt2" align="center">
<
script type="text/javascript"><!--
google_ad_client "pub-xxxxxxxxxxxxx";
google_alternate_ad_url "http://www.mysite.com/forum/google_adsense_script.html";
google_ad_width 728;
google_ad_height 90;
google_ad_format "728x90_as";
google_ad_type "text";
google_ad_channel ="9100589350";
google_color_border "EFF0F3";
google_color_bg "EFF0F3";
google_color_link "445683";
google_color_url "445683";
google_color_text "798AB4";
//--></script>
<script type="text/javascript"
  
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</
script>
    </
td>
</
tr>
</
table>
</
div>
$spacer_close
</if>
</if>
</if>
<!-- / 
RandomAds for unregistered users --> 
But I hit and miss. Does anyone see, where I went wrong..? Guess I can?t see the wood because of all the trees...
Reply With Quote
  #142  
Old 03-30-2006, 01:47 PM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Marv

Try replacing the plugin code with this (untested)

edit: removed, that's not going to work. Have a meeting to go to now but will look at it a bit later
Reply With Quote
  #143  
Old 03-30-2006, 01:50 PM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Took less time than I thought - give this a try:

Code:
// only for non-threaded display
if($threadedmode == 0) {

	// only need to do the calculation once
	if( $counter == 2 && empty($GLOBALS['adsense_position'] && $totalposts >= 3 ) ) {

		$_min = $postcount;
		$_max = min($totalposts,$_min+$perpage-1) - 1;

		$GLOBALS['adsense_position'] = rand($_min,$_max);
	}

}
Reply With Quote
  #144  
Old 03-30-2006, 11:59 PM
EyeCrave EyeCrave is offline
 
Join Date: Sep 2002
Location: Layer 2 of the DVD
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get this error with that code above:

Parse error: parse error, unexpected T_BOOLEAN_AND, expecting ')' in /pathto/showthread.php(1031) : eval()'d code on line 5

BTW - awesome plugin.
Reply With Quote
  #145  
Old 03-31-2006, 06:38 AM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OOps - that's what happens when you do things in a hurry. Try this for size:

Code:
// only for non-threaded display
if($threadedmode == 0) {

	// only need to do the calculation once
	if( $counter == 2 && empty($GLOBALS['adsense_position']) && $totalposts >= 3 ) {

		$_min = $postcount;
		$_max = min($totalposts,$_min+$perpage-1) - 1;

		$GLOBALS['adsense_position'] = rand($_min,$_max);
	}

}
Reply With Quote
  #146  
Old 03-31-2006, 08:02 PM
EyeCrave EyeCrave is offline
 
Join Date: Sep 2002
Location: Layer 2 of the DVD
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works. Thank you!
Reply With Quote
  #147  
Old 04-01-2006, 08:46 AM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by UK Jimbo
OOps - that's what happens when you do things in a hurry.
Thx UK-Jimbo,

I?ll give it a try and report back to you asap.
Reply With Quote
  #148  
Old 04-05-2006, 04:23 PM
The Chief's Avatar
The Chief The Chief is offline
 
Join Date: Aug 2005
Location: Montreal
Posts: 1,037
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

installed and works great!!
Reply With Quote
  #149  
Old 04-06-2006, 02:38 AM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marv
Thx UK-Jimbo,

I?ll give it a try and report back to you asap.
Any luck?
Reply With Quote
  #150  
Old 04-06-2006, 11:17 AM
GrendelKhan{TSU's Avatar
GrendelKhan{TSU GrendelKhan{TSU is offline
 
Join Date: Jun 2005
Location: Boston | Seoul, S. Korea
Posts: 1,311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know if cause I installed this wrong or the Googlebot just isn't doing its job (so to speak)...

but I'm having trouble actually getting relevant ads. I don't think the googlebot is actually "reading" the content of the page. I always get ads for "free forum software" and related.

ie: I think its basically only reading the footer. or something

any ideas as to what is blocking or causing the Gbot to not actually dig into the content?
Reply With Quote
  #151  
Old 04-06-2006, 03:09 PM
UK Jimbo's Avatar
UK Jimbo UK Jimbo is offline
 
Join Date: Sep 2002
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi GrendelKhan

Are the pages publically visible or do you have to register to see them? If Googlebot can't get at the pages (and content) from the same URL that you're using to access it then it can't index it. Sometimes it might take a while for pages to get indexed. I'd give it a couple of days and see how it goes. Post back and let me know how you get on.
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 12:36 AM.


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.05312 seconds
  • Memory Usage 2,388KB
  • Queries Executed 31 (?)
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
  • (1)bbcode_html
  • (2)bbcode_php
  • (4)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
  • (4)pagenav_pagelink
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)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