Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-04-2013, 10:14 PM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to show Adsense Mobile Ad Unit in Mobile Theme?

Hello,

How to show Adsense Mobile Ad Unit (PHP 4.3.0 or greater) in Mobile Theme?

This is the adsense code Mobile Ad Unit for mobile version.

PHP Code:
<?php

$GLOBALS
['google']['client']='ca-mb-pub-xxxxxxxxxxxx';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='chtml';
$GLOBALS['google']['output']='chtml';
$GLOBALS['google']['ref']=read_global('HTTP_REFERER');
$GLOBALS['google']['slotname']='xxxxxxxxxxx';
$GLOBALS['google']['url']=read_global('HTTP_HOST') . read_global('REQUEST_URI');
$GLOBALS['google']['useragent']=read_global('HTTP_USER_AGENT');
$google_dt time();
google_set_screen_res();
google_set_muid();
google_set_via_and_accept();
function 
read_global($var) {
  return isset(
$_SERVER[$var]) ? $_SERVER[$var]: '';
}

function 
google_append_url(&$url$param$value) {
  
$url .= '&' $param '=' urlencode($value);
}

function 
google_append_globals(&$url$param) {
  
google_append_url($url$param$GLOBALS['google'][$param]);
}

function 
google_append_color(&$url$param) {
  global 
$google_dt;
  
$color_array explode(','$GLOBALS['google'][$param]);
  
google_append_url($url$param,
                    
$color_array[$google_dt count($color_array)]);
}

function 
google_set_screen_res() {
  
$screen_res read_global('HTTP_UA_PIXELS');
  if (
$screen_res == '') {
    
$screen_res read_global('HTTP_X_UP_DEVCAP_SCREENPIXELS');
  }
  if (
$screen_res == '') {
    
$screen_res read_global('HTTP_X_JPHONE_DISPLAY');
  }
  
$res_array preg_split('/[x,*]/'$screen_res);
  if (
count($res_array) == 2) {
    
$GLOBALS['google']['u_w']=$res_array[0];
    
$GLOBALS['google']['u_h']=$res_array[1];
  }
}

function 
google_set_muid() {
  
$muid read_global('HTTP_X_DCMGUID');
  if (
$muid != '') {
    
$GLOBALS['google']['muid']=$muid;
     return;
  }
  
$muid read_global('HTTP_X_UP_SUBNO');
  if (
$muid != '') {
    
$GLOBALS['google']['muid']=$muid;
     return;
  }
  
$muid read_global('HTTP_X_JPHONE_UID');
  if (
$muid != '') {
    
$GLOBALS['google']['muid']=$muid;
     return;
  }
  
$muid read_global('HTTP_X_EM_UID');
  if (
$muid != '') {
    
$GLOBALS['google']['muid']=$muid;
     return;
  }
}

function 
google_set_via_and_accept() {
  
$ua read_global('HTTP_USER_AGENT');
  if (
$ua == '') {
    
$GLOBALS['google']['via']=read_global('HTTP_VIA');
    
$GLOBALS['google']['accept']=read_global('HTTP_ACCEPT');
  }
}

function 
google_get_ad_url() {
  
$google_ad_url 'http://pagead2.googlesyndication.com/pagead/ads?';
  
google_append_url($google_ad_url'dt',
                    
round(1000 array_sum(explode(' 'microtime()))));
  foreach (
$GLOBALS['google'] as $param => $value) {
    if (
strpos($param'color_') === 0) {
      
google_append_color($google_ad_url$param);
    } else if (
strpos($param'url') === 0) {
      
$google_scheme = ($GLOBALS['google']['https'] == 'on')
          ? 
'https://' 'http://';
      
google_append_url($google_ad_url$param,
                        
$google_scheme $GLOBALS['google'][$param]);
    } else {
      
google_append_globals($google_ad_url$param);
    }
  }
  return 
$google_ad_url;
}

$google_ad_handle = @fopen(google_get_ad_url(), 'r');
if (
$google_ad_handle) {
  while (!
feof($google_ad_handle)) {
    echo 
fread($google_ad_handlexxxx);
  }
  
fclose($google_ad_handle);
}

?>
If I insert the adsense code in vbulletin theme, i got error.

Can someone help me, please!

Thank you.
Reply With Quote
 


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 03:06 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.03851 seconds
  • Memory Usage 2,364KB
  • Queries Executed 12 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete