Created
December 12, 2012 16:49
-
-
Save christophergregory/4269413 to your computer and use it in GitHub Desktop.
Shopify: Array loop divider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="looper"> | |
{% assign range = 5 %} | |
{% assign min = 0 %} | |
{% assign max = range %} | |
{% assign iter = 0 %} | |
{% assign arr = 'asdfasdf,asdfasf,aafa,asdfas,asass,asdsd,asdads,asdfasf,asdadss,aflkjlfakl,asldf,asldkfjasl,aslas,asldkfjasldkfjasdkf,lskl,asdlfjadslkf,asdfasfs,asdflkjasdl,asdlfkjaslf,asdfas,asdlfkjasdfl,asdfalda' | split: "," %} | |
{% for i in arr %} | |
{% assign iter = forloop.index %} | |
{% if forloop.index0 == min %} | |
<div class="test"> | |
{% endif %} | |
{% if forloop.index > min and forloop.index <= max %} | |
{{ i }} | |
{% endif %} | |
{% if forloop.index == max %} | |
</div> | |
{% assign min = min | plus: range %} | |
{% assign max = max | plus: range %} | |
{% endif %} | |
{% endfor %} | |
{% unless iter == max %} | |
</div><!-- End --> | |
{% endunless %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment