2014-09-22 41 views
0

我想要做這樣的事情在Shopify:shopify傳遞變量來設置

{% for i in (0..10) %} 
    {% capture slide %}slide{{i}}{% endcapture %} 
    {{ settings.slide }}//i need the value of this one 
    // i want to get the values for settings.slide1, settings.slide2 etc 
{% endfor %} 

又如:

{% for i in (0..10) %} 
    {{ settings.slide[i] }}//i need the value of this one 
{% endfor %} 

這是什麼即時試圖實現一個簡化版本。 感謝

回答

1

試試這個:

{% for i in (0..10) %} 
    {% assign current_slide = 'slide' | append: i %} 
    {{ settings[current_slide] }} 
{% endfor %}