Thursday, August 30, 2007

Joomla and phpAdsNew Integration

What is phpAdsNew? phpAdsNew is an open-source ad server, with an integrated banner management interface and tracking system for gathering statistics. With phpAdsNew you can easily rotate advertisements. You can even integrate banners from third party advertising companies. phpAdsNew is very useful for those who run multiple websites. This means you only have to manage your ads from one location.

Here is a quick tip on how to integrate phpAdsNew to Joomla.

Step 1: Understand phpAdsNew.

The first step is to know how to use phpAdsNew. phpAdsNew will be confusing for those who don't understand advertising terminologies. You need to know what is a "campaign", "zone", "advertiser", "publisher", etc. Once you understand all of these, you'll find this application really useful. Please refer to phpAdsNew documentations here.

Step 2. Download and install phpAdsNew. (currently version 2.0.8)

Download phpAdsNew here. phpAdsNew is also packaged in Fantastico from your CPANEL. But I prefer direct download from their site to get the latest version. Just take note that you have to install phpAdsNew on the same server as your websites. I know phpAdsNew can do remote invocation but i'm not sure if it works with Joomla integration. Installation is just like installing Joomla. I suggest using a sub-domain for phpAdsNew installation. For example adserver.yoursite.com.

Step 3. Setup ads in phpAdsNew.

I am not going to cover this process but you can refer to phpAdsNew documentations here.

Step 4. Download and install "KL evalPHP" module and "Imbed PHP" mambot by John Long.

Download "KL evalPHP" Joomla module here. You can also use the "Imbed PHP" mambot so you can embed your ads on Joomla contents. Download Imbed PHP here.

Step 5. Configure the KL evalPHP module.

For those still at lost with Joomla module concept, you can create copies of this module and assign it to different module sections such as "advert1", "advert2", "banner", etc. After you complete this one module, just copy the module and configure the copy and assign it on a different module section with different invocation code.

But first, lets configure one module. You have to generate invocation code from your phpAdsNew publisher zone. From phpAdsNew administration, go to:

INVENTORY >> PUBLISHERS & ZONES >> (click one publisher) >> ZONE OVERVIEW >> (click one zone) >> INVOCATIONCODE

phpAdsNew Admin
phpAdsNew Admin

  • You need to choose "LOCAL MODE" for banner invocation.
  • Copy the invocation code and put it in your module PHP Script parameter.
  • Remove the PHP opening and close tag.
  • If phpAdsNew is hosted from a different domain, you need to hard code the "phpadsnew.inc.php" path reference.
KL evalPHP module
KL evalPHP module


Original Invocation Code:


if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:16', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?>

Edited Invocation Code for Joomla module:

if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:16', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}

If phpAdsNew is hosted on a different domain:

if (@include('/home/yoursite/phpAdsNew/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:16', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}

That's it. This is just a quick tip. I know those new to Joomla might not get it. Please use this forum thread if you need some assistance.

Source: Joomlahacks.com
feed

No comments: