PDA

View Full Version : Miscellaneous Hacks - AdSense for Mobile Content


WNxWakko
11-16-2008, 10:00 PM
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:


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 (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=196544)

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 ?