vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - AdSense for Mobile Content (https://vborg.vbsupport.ru/showthread.php?t=196544)

WNxWakko 11-16-2008 10:00 PM

AdSense for Mobile Content
 
AdSense for Mobile Content in VB Templates

If you have ever attempted to create the Adsense for Mobile Content then you probably hit a stumbling block when it didn't give you the code it normally provides for regular ads.

The problem is you cant just copy paste the code google gives you and expect it to work. Google gives you the following four options and none of these can be pasted into VB Templates.

AdSense for Mobile Content generated code options.
PHP
CGI/Perl
JSP
ASP

Here is the PHP Solution

How to add Adsense for Mobile Content into your VB mobile template using the PHP include code bits.

Requirements:
1 New Plugin
1 New File
1 Template Edit

Instructions:

Since the information you need to put in all three of these will vary on your server paths, I dont know any way to give you a plugin to import that wouldn't require you to change it anyway. You will need to create these manually. Some of this I found in the VB handbook.

1. Create a Plug-in for global_start with these contents:

Code:

  ob_start();
  include('path/to/this/file/mobilead.php');
  $mobileadsense = ob_get_contents();
  ob_end_clean();

Replace the path and filename with the correct path and filename of the PHP file you want to include. The code in mobilead.php will execute and any output generated by this script will be stored in $mobileadsense

---------------

2. Create the PHP file

Login to your Google Adsense account and create a AdSense for Mobile Content.
Choose Server-side scripting language: PHP

Since the contents of this PHP file will be different for everyones individual account you will need to create it. When you see Your AdSense code showing in PHP, copy that into a newly created PHP file and call it "mobilead.php"

Upload the file to your root directory or where ever you wish to have it reside.
---------------

3. Template Change

Place $mobileadsense in one of your templates, such as header, navbar, FORUMHOME, depending upon where you want the mobile ads to display.

Your done!

If you wish to create more than one ad, just repeat the process and use a different name on the files and variables.

Enjoy!

If you use this, please click install

Hornstar 11-17-2008 07:23 PM

If only google didnt ban me in the early days id give this a go now :/

unp 11-18-2008 01:55 PM

Not working for me.

WNxWakko 11-20-2008 12:08 AM

Are you testing using your PC browser? If you are it wont display. Google designed the code to only appear if you are using a mobile device. Confirm your testing with a mobile.

gwerzal 11-20-2008 12:15 AM

Thanks il give it a go

tpearl5 01-20-2009 12:43 PM

Thanks! This is exactly what I was looking for... however, I can't get any ads to display - I'm not getting any errors.

iamthemoz 02-09-2009 11:41 AM

Thanks! Works great!

iamthemoz 11-08-2009 11:00 AM

Recently this plugin has had a major impact on the speed of my site. I had to uninstall. Any ideas?

Naijasite 04-01-2013 09:00 PM

how do i make it work on mobile style 4.2 ?


All times are GMT. The time now is 11:48 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.01174 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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