Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- When doing something like <!--video-id:abcabc-->
- {% assign video-id = collection.description | split: 'video-id:' | last | split: '-->' | first %}
- When you need multiple and dont know how many,
- Example images for a slider:
- {% assign inaction-images = collection.description | split: '<!--endinaction-->' | first | split: '<img' %}
- {% for image in inaction-images %}
- {% if forloop.first == true %}
- {% comment %}do nothing because this is text/html before the img tag{% endcomment %}
- {% else %}
- {% assign src = image | split: ' src="' | last | split:'"' | first %}
- <a href="javascript:;" class="js-in-action-image" data-sort="0" data-image="{{ src }}" data-zoom-image="{{ src }}">
- <img src="{{ src }}" />
- </a>
- {% endif %}
- {% endfor %}
- Example, handles grabbed from a list of comments <!--add-on:test-chocolate--><!--add-on:test-liquor-->
- {% if product.description contains 'add-on:' %}
- {% assign add-on-list = product.description | split: 'add-on:' %}
- <div class="add-ons">
- {% for add-on in add-on-list %}
- {% unless forloop.first %}
- {% assign handle = add-on | split: ':' | last | split: '-->' | first %}
- <div class="add-on-item">
- <p>{{ all_products[handle].title }}</p>
- <img src="{{ all_products[handle].featured_image | img_url: '200x' }}" alt="">
- </div>
- {% endunless %}
- {% endfor %}
- </div>
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement