I believe you can add a control to the to page to be executed either on the Page_Unload or Foot_Render events, depending upon where you want your code to be added.
So, it could look something like the following (mind you, this might be buggy, haven't actually tested it yet):
class AddAdCode extends Control
{
function AdCode(&$Context)
{
$this->Context = &$Context;
}
function Render()
{
$this->Context->Writer->Write('whatever you want to add here');
}
}
$AdCode = $Context->ObjectFactory->NewContextObject($Context, 'AddAdCode');
$Page->AddControl('Foot_Render', $AdCode);
//OR $Page->AddControl('Page_Unload', $AdCode);
It's probably easiest to just put it in as an extension. Pop this into a file in the extensions/ dir (obviously replacing the written string with the actual code) and enable it in the administration panel. Should work.
<?php
/*
Extension Name: Ad Code
Extension Url: mailto:sirnot@gmail.com
Description: Adds ad code to all pages.
Version: 1.0
Author: SirNot
Author Url: mailto:sirnot@gmail.com
*/
class AddAdCode extends Control
{
function AdCode(&$Context)
{
$this->Context = &$Context;
}
function Render()
{
$this->Context->Writer->Write('whatever you want to add here');
}
}
$AdCode = $Context->ObjectFactory->NewContextObject($Context, 'AddAdCode');
$Page->AddControl('Foot_Render', $AdCode);
//OR $Page->AddControl('Page_Unload', $AdCode);
?>
Comments
So, it could look something like the following (mind you, this might be buggy, haven't actually tested it yet):