- How to add AdSense to PHPNuke
- Posted by pipebomb on December 5th, 2003
I searched high and low for this, and finally got it figured out. I
thought I might post it for anyone else having problems. Hope this
helps someone else out there.
In my case, I added it to my theme.php file, where 'include
banner.php' usually is; it works great and is showing relevant ads so
far. Your mileage may vary.
-----START COPY-----
echo "<script type=\"text/javascript\"><!--\n"
.."google_ad_client = \"pub-6838469183294466\";\n"
.."google_ad_width = 468;\n"
.."google_ad_height = 60;\n"
.."google_ad_format = \"468x60_as\";\n"
.."google_color_border = \"CCCCCC\";\n"
.."google_color_bg = \"FFFFFF\";\n"
.."google_color_link = \"000000\";\n"
.."google_color_url = \"666666\";\n"
.."google_color_text = \"CCCCCC\";\n"
.."//--></script>\n"
.."<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n"
.."</script> \n";
-----END COPY-----
You will of course want to change the appropriate fields; but make
sure you don't lose any characters, as it will break your page
otherwise.

You can also use a block (taken from the block-GoogleAdSense.php file,
credited below):
-------------START COPY------------------------------
<?php
/************************************************** **********************/
/* GoogleAdsense Block
*/
/* ===========================
*/
/*
*/
/* Copyright (c) 2003 by Tyler Mammone
*/
/* http://www.vie4life.com
*/
/*
*/
/*
*/
/************************************************** **********************/
/* PHP-NUKE: Web Portal System
*/
/* ===========================
*/
/*
*/
/* Copyright (c) 2003 by Francisco Burzi
*/
/* http://phpnuke.org
*/
/*
*/
/* This program is free software. You can redistribute it and/or
modify */
/* it under the terms of the GNU General Public License as published
by */
/* the Free Software Foundation; either version 2 of the License.
*/
/************************************************** **********************/
/************************************************** **********************/
/*
*/
/* If you don't have an account, go to http://www.google.com/adsense
*/
/* and sign up. After you are approved create a new Ad Layout for a
*/
/* 120x600 Skyscraper. Copy the google_ad_client variable from the
*/
/* html code the google site gives you, and enter it below. You may
*/
/* configure the following 7 variables to better suit your website.
*/
/*
*/
/* Save and upload this file into your /blocks folder.
*/
/*
*/
$number_of_ads_to_show = "2";
/*
*/
$google_color_border = "216BB0";
/*
*/
$google_color_bg = "FFFFFF";
/*
*/
$google_color_link = "000000";
/*
*/
$google_color_url = "216BB0";
/*
*/
$google_color_text = "000000";
/*
*/
$google_ad_client = "pub-9839777177813177";
/*
*/
/************************************************** **********************/
/************************************************** **********************/
/* DO NOT EDIT BELOW THIS LINE
*/
/************************************************** **********************/
/************************************************** **********************/
if (eregi("block-GoogleAdSense.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
if ($number_of_ads_to_show == 1) { $ad_height = 162; }
elseif ($number_of_ads_to_show == 2) { $ad_height = 308; }
elseif ($number_of_ads_to_show == 3) { $ad_height = 454; }
elseif ($number_of_ads_to_show == 4) { $ad_height = 600; }
$content .= "<center><script type=\"text/javascript\"><!--\n"
.."google_ad_client = \"$google_ad_client\";\n"
.."google_ad_width = 120;\n"
.."google_ad_height = $ad_height;\n"
.."google_ad_format = \"120x600_as\";\n"
.."google_color_border = \"$google_color_border\";\n"
.."google_color_bg = \"$google_color_bg\";\n"
.."google_color_link = \"$google_color_link\";\n"
.."google_color_url = \"$google_color_url\";\n"
.."google_color_text = \"$google_color_text\";\n"
.."//--></script>\n"
.."<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n"
.."</script></center>\n";
/************************************************** **********************/
/************************************************** **********************/
?>
------------------END COPY-------------------------


