Example 3: Display the Current Category Number¶
The example below demonstrates how to display numbers of available product categories using a counter:
<ul>
<!--{foreach $.categories as index => category}-->
<li>#<!--{= index}--> <a href="<!--{= category.link }-->"><!--{= category.title }-->(<!--{= category.count }-->)</a></li>
<!--{/foreach}-->
</ul>
Attribute | Description |
---|---|
category | the list of available categories |
index | counter |
categories | items of the categories array |
Note
You should bear in mind that numbering starts from 0.
See also