Modules | Webapps

Webapp Split output

Problem: How can i split every X items into a div or ul ?

Liquid code needed:

{% for item in collection.items %}
    {% capture itemCount %}{% cycle '1', '2', '3', '4' %}{% endcapture %}
    {% if itemCount == '1' %}<ul>{% endif %}
   	<li>{{item.name}}</li>
    {% if itemCount == '4' or forloop.last %}</ul>{% endif %}
{% endfor %}
Output:
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10