Pure Prostore SSML Dynamic Table Column Display
Generates a dynamic HTML table using pure Prostore SSML.
Just set the maximum number of columns you want displayed and voila!
<!--
Dynamic html table using pure SSML
By: Hoang Tran <ht@dynamic.com>
Date: 2010-05-20
-->
<table>
<tbody>
<!-- set max columns here -->
<ss:set name="maxCol" value="$system.getMath(2)"/>
<!-- initialization -->
<!-- start count at zero for lines between products -->
<ss:set name="colCount" value="$system.getMath(0)"/>
<!--
loop through any type of collection
In this case its a collection of products in a category name "Gallery"
-->
<ss:foreach item="product" within="$store.categories['Gallery'].products">
<ss:if test="$colCount.get() == 0">
<tr>
</ss:if>
<td>
<!-- do what you want with the current item -->
<ss:value source="$product.name" />
</td>
<ss:eval source="$colCount.set($colCount.add(1))"/>
<ss:if test="$colCount.get() == $maxCol.get()">
<ss:eval source="$colCount.set(0)"/>
</tr>
</ss:if>
</ss:foreach>
<ss:if test="$colCount.get() > 0 && $colCount.get() < $maxCol.get()">
<ss:set name="colSpan" value="$system.getMath($math.difference($maxCol.get(),$colCount.get()))" />
<td colspan="$colSpan.get()">
</td>
<ss:eval source="$colCount.set(0)"/>
</tr>
</ss:if>
</tbody>
</table>
