Skip to content

Instantly share code, notes, and snippets.

@WilCF
Created June 15, 2015 17:09
Show Gist options
  • Save WilCF/8d037ec01c9a8f330e77 to your computer and use it in GitHub Desktop.
Save WilCF/8d037ec01c9a8f330e77 to your computer and use it in GitHub Desktop.
Liquid For-Loop
<!-- The 'cml:select' tag is in regards to a dropdown list, where each dropdown option is a subtag labeled 'cml:option'. -->
<cml:select label="What type of room is this a part of?" name="room_type" instructions="Remember, use the image name as reference and verify the correct room type on the hotel website." only-if="hotel:[1]++notonlist:unchecked" gold="true">
<cml:option label="CF room" value="bad"></cml:option>
<!-- A Liquid for Designers for loop is used here to create each room type option from the choices list. 'item' is an arbritrary value for the for loop, but it must match the cml:option label. The value of this cml:option is also a Liquid value that inputs the corresponding value of an 'item' in the 'choices' array by calling the 'item's index number -->
{% for item in choices %}
<cml:option label="{{item}}" value="{{choices[forloop.index0]}}"></cml:option>
{% endfor %}
</cml:select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment