Add OpenX advertising banners in a portlet

by Jon Stahl last modified May 14, 2009 05:49 PM
It is easy to add advertising banners produced by OpenX into a TAL Portlet. Here's how.

You can ad OpenX Ad Zones as Portlets by putting the javascript code into a TAL Portlet. 

Requirements

Once you have TAL Portlet installed

  1. Go to the relevant section of the site, click Manage Portlets.
  2. Add a "TAL Portlet"  (you can't use a Static Text portlet because the Ad Zone javascript will get filtered by Plone as unsafe).
  3. The TAL Portlet will have default code as follows:
    <dl class="portlet portlet${portlet_type_name}"
        tal:define="portal_state context/@@plone_portal_state;
                    context_state context/@@plone_context_state;">
    
        <dt class="portletHeader">
            <span class="portletTopLeft"></span>
            <span>
               Header
            </span>
            <span class="portletTopRight"></span>
        </dt>
    
        <dd class="portletItem odd">
            Body text
        </dd>
        
        <dd class="portletFooter">
            <span class="portletBotomLeft"></span>
            <span>
               Footer
            </span>
            <span class="portletBottomRight"></span>
        </dd>
    
    </dl>
    
    
  4. Paste the javascript code in where it says "Body text" above.  If you don't want the portlet to have a header or footer, remove the <dd class="portletHeader"> and/or <dd class="portletFooter"> blocks as appropriate.  To change the portlet title, replace the text "Header."
  5. Save the portlet.  Reposition as needed.