Google AdSense を使用しているのですが

モバイル向けGoogle AdSense コード

Smartyテンプレート に貼り付けたくて調べてみました。

普通に、以下の内容で貼り付けると Google AdSense が表示しないです。


<?PHP

$GLOBALS['google']['client']='';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['output']='xhtml';
$google_ad_handle = @fopen(google_get_ad_url(), 'r');

省略

if ($google_ad_handle) {
  while (!feof($google_ad_handle)) {
    echo fread($google_ad_handle, 8192);
  }
  fclose($google_ad_handle);
}

?>

 

こちらの内容で入力すると、Google AdSense が表示します。


{php}

$GLOBALS['google']['client']='';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['output']='xhtml';
$google_ad_handle = @fopen(google_get_ad_url(), 'r');

省略

if ($google_ad_handle) {
  while (!feof($google_ad_handle)) {
    echo fread($google_ad_handle, 8192);
  }
  fclose($google_ad_handle);
}

{/php}

 

<?php   を   {php}   また   ?>  を  {/php}  に変更する事で

Google AdSense が表示するようになりました。