Logic Tags
Tag foreach


This tag allows you to loop over data collections stored in memory as XPArrayLists. The data collection should not be modified while looping to avoid unpredictable side effects.

Example:
<pt:logic.foreach pt:data="testcollection" pt:var="co">
<pt:core.html pt:tag="a" href="$co.url">
<pt:logic.value pt:value="$co.name"/>
</pt:core.html>
<pt:logic.separator><br>-----<br></pt:logic.separator>
</pt:logic.foreach>


Tag Information
Tag Nameforeach
Related Child Tag(s)separator

Attributes
NameTypeRequiredDefault ValueDescription
datastringtruenullThe key used to retrieve the XPArrayList data collection as a shared variable from Tag or PortletRequest scope memory.
varstringfalseforeachvarThe key used to store the current IDataObject in Tag scope memory as an editable shared variable. This tag will restore the original value of this variable after the tag is finished processing, meaning that multiple foreach loops can share the same variable name, although it is considered a best practice to use unique names for the variable attribute for each foreach tag. If this variable already exists, it must be editable.


Copyright 2005 Plumtree Software, Inc.