User Tools

Site Tools


en:public:developer:template_system:tags:promotion:tpromotions:create

<#TPromotions.create>

You can use this tag to construct a TPromotions object. The list of all the promotional boxes will be taken from the cfgpages configuration file

<#Promotions>

When the tag <#Promotions> is use without any path (like <#Promotions.count> for exemple) then it's the Constructor of a TPromotions object that will be available via the var named Promotions.

Parameters

Name Mandatory Default Description
Name Yes the name of the space (right, left, etc.). It's must be the same as the name of the space configured in the cfgpages xml file configuration
VarName Yes Promotions The name of the variable that will be assigned to the newly created object.
Template No If not empty then Parse this template with the new created TPromotions object, return the result and free the object

cfgpages configuration

The list of promotional boxes will be taken from the cfgpages xml file configuration. ex if the xml file configuration contain :

  <page name='/'>
    <cfg>
      ...
      <promotions name="right" maxtoshow="2" random="1" />
        <promotion processname="hardfile" filename="promo1.html" random="0" />
        <promotion processname="hardfile" filename="promo2.html" />
        <promotion processname="hardfile" filename="promo3.html" />
      </promotions>
      <promotions name="left">
        <promotion processname="hardfile" filename="leftframe_promo_google_120x240.html"/>
      </promotions>
    </cfg>
    ...
  </page>

then the <#promotions name=“right”> will add in the <#TPromotions> object 3 items (promo1.html, promo2.html and promo3.html). But As maxtoshow=“2” then only 2 items only will be added and as random=“1” then the <#TPromotions> object will contain only 2 items, promo1.html (because random=“0” for this promotion, so it's prioritary) and one another taken randomly from (promo2.html, promo3.html).

Example

  <#{promotions name="right">
    <#{template>
      <#if condition="<#promotions.count> > 0">
        <#promotions[0].content>
      <#endif>
    <#}template>
  <#}promotions>
  

this will output

  <#frame processname="hardfile" filename="promo1.html">
en/public/developer/template_system/tags/promotion/tpromotions/create.txt · Last modified: 2013/04/24 12:04 by svanderclock