Context: hometechnologyPostNukePHPadsNew  
Technology

  Middleware
  PC upgrades
  Open Source
  PostNuke

Home
 
 Search Site
 
 

Back

Integrating PHPadsNew with PostNuke

This document details the method I used to integrate PHPadsNew with PostNuke v0.71/v.072. The method completely replaces the existing PostNuke banners system, and provides full access to PHPadsNew's features in the theme and in blocks.

The integration involves running PHPadsNew as a local application - in the same environment as PostNuke. All features of PHPadsNew can be used: GIF, JPG and Flash banners, zones for different areas of the theme, different zones in different blocks, and campaign targeting by different areas of the PostNuke site.

This is not an official release. I have not utilised the language system. There are no guarantees. This is a hack that you may use if you wish and take on board how you like.

Here are the files I created or replaced in PostNuke:

1. New file: modules/NS-Banners/blocks/banner.php

This file provides banner facilities in a block. Any block may be used: left, right, centre - or any others you may have defined. The block takes a parameter: banner selection. This parameter is passed direct to PHPadsNew as the 'selection' parameter. The parameter is used to select zones, compaigns, clients or a combination of these.

2. Modified file: modules/NS-Banners/admin.php

Three new configiration items for the banner module: zonea, zoneb and zonec. These are the 'selection' parameters for the theme. Within the theme the selection parameter values can be fetched using pnModGetVar('Banners', 'zonea') to pnModGetVar('Banners', 'zonec') and this is passed into the banner fetch function. Within the theme, banner A can be fetched using:

$bannera = pnBannerGet(pnModGetVar('Banners', 'zonea'));

The parameters in admin.php provide a convenient way to change the selection criteria without having to edit the theme file.

3. Modified file: includes/pnBanners.php

This is where it all happens. The new banner function pulls the banner from the PHPadsNew API. The API is called up with the following parameters:

  • selection - the selection parameter value passed in by the theme or the block.
  • client - zero (i.e. no specific client - the selection parameter can be select a client using 'client:<n>').
  • target - I have set this to '_blank', but it really should be configurable for a block. A block may contain an advertising campaign that links back to the current site, so a new window is not always needed. Just add a new default parameter to pnBannerGet() and pnBannerDisplay() to accept the target and pass it in from the block.
  • source - this is used to target the campaigns to different sections of the site. This function puts a string togetehr of the following form: 'module-category_id-item_id'. Within PHPadsNew targetting can be set up (using wildcards) so that campaigns are targetting to a particular module, category or individual item page. Since each module defines a category and an item using different methods and parameter names, there are some hard-coded algorithms in this section to determine these values. It is not ideal, and you will need to add code here for each module you want to use for targetting.

The zip file contains all these files and a sample theme usage - don't install it over your site files - it is just an example of the methods used - but do us it as examples to follow and code to extract.

Let me know if I have missed anything out or you need further examples (jason@academe.co.uk).

I hope you find this useful!

You can find PHPadsNew on the sourceforge site (phpadsnew.sourceforge.net). PostNuke is here: www.postnuke.com.


Last updated: Wednesday, 28-May-2008 16:14:39 BST


Related pages and links...

homeSee also...

 Home Copyright © 2001 Academe Computing Ltd. All rights reserved. e-mail webmaster