Menu

#1 multiple google ads function

open
nobody
None
5
2005-12-03
2005-12-03
Adeptics
No

I've modified an rssgm site and thought someone might
find what I've changed worth adding to their site/project.

I like to use more than one google ad block so instead
of creating a separate google.php file for each block
(I had done this for an rssg site) I created a function
to facilitate this.

Instead of including the google.php file in the
templates files I echo the googleAds function with the
desired ad format:

<?php
echo googleAds("120x600_as");
?>

You can also supply the colors for the ad block:
<?php
echo googleAds("120x600_as", "FF4500", "FFEBCD",
"DE7008", "E0AD12", "8B4513");
?>

I also added adsense channel, a show google ads option,
and included the new google_ads.php file in config.php:

#################### GOOGLE ADSENSE
#########################
$show_google = "1"; // Display Google Ads
$adsense_pub = "pub-xxxxxxxxxxxxxx"; // Adsense pub code.
$adsense_channel = "xxxxxxxxxx"; // Adsense channel
require_once("google.php");

This solution is pretty simple and could be carried
over to the other ad modules (i.e. chitika) pretty easily.

Discussion

  • Adeptics

    Adeptics - 2005-12-03

    google ads function

     
  • Adeptics

    Adeptics - 2005-12-03

    Logged In: YES
    user_id=1101717

    whoops that require should be:

    require_once("google_ads.php");

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.