This is an old revision of the document!
When the tag <#Promotions> is use without any path (like <#Promotions.text> for exemple) then it's the Constructor of a TPromotions object. The new created object will be available via the var named Promotions. You can use this tag (Without any path) to construct a TPromotions object (and store it in the variable named <#Promotions>) or to return directly the html content of all promotional boxes for a given space (if you specified some values for the parameter Template and Template_item). The list of promotional boxes is taken from the cfgpages configuration file
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 | |
Template | No | On success, Parse this template with the new created TPromotions object, return the result and free the object | |
Template_item | No | The template to use to build the content of one item |
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 <#promotions_items> 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 <#promotions_items> 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).
<#{promotions name="right"> <#{template_container><#promotions_items.text><#}template_container> <#{template_item> <div<#if condition='<#promotions_current_item.index> < <#promotions_items.count> - 1'> style="margin-bottom:15px;"<#endif>> <#promotions_current_item.text> </div> <#}template_item> <#}promotions>