Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how to at the ad code at the bottom of every page

edited November 2005 in Vanilla 1.0 Help
please help me... it is needed in my host

Comments

  • NickENickE New
    edited November 2005
    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);
    
  • oh, but please tell me which page should i put these code in. thank you
  • 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);
    
    ?>
    
This discussion has been closed.