Documentation Center

Iterating over collections

When Java code is generated from TCDL variables are automatically created using default names. You can specify your own variable names and use these variables in your TCDL tags, for example if the default variable names conflict with existing names.

Default variable names
By default, the following variable names are used for collections and items in the collections:
TagCollection variable nameItem variable name
<tcdl:promotions>promotionspromotion
<tcdl:promotionalItems>promotionalItemspromotionalItem
<tcdl:items>itemsitem
Declaring a variable
Use the var attribute in the tag exposing the collection to declare your own variable name, for example var='myVariableNameForCollection'.
Calling the item collection
Use the items attribute on the itemTemplate tag to call the item collection, for example items='myVariableNameForCollection':
  • In Java code, prefix the variable name with a dollar sign, for example ${items}
  • In Dreamweaver Templates, prefix the variable name with a hash sign, for example #{VariableName}