Liquid tag inside another liquid tag
hi guys
my problem relative simple, , quite sure making more complex is.
i want use built-in gallery module client want upload images server , little work possible in admin.
the first thing need gallery overview. made this:
{module_data resource="photogalleries" version="v3" fields="id,photogalleryname" skip="0" limit="500" order="id" collection="photogalleries"}
{% item in photogalleries.items %}
<a href="/galleriv2?album={{item.id}}&name={{item.photogalleryname}}">gå til {{item.photogalleryname}} galleri </a>
<br /><br />
{% endfor -%}
that gives me list of galleries, , put id in link can display correct images on gallery page.
on page do:
{module_photogallery id="{{globals.get.album}}" template="" collection="photogalleryv2" resultsperpage="500"}
{% item in photogalleryv2.items %}
<li class="grid-item format-image projects">
<div class="grid-item-inner">
<a href="{{item.link}}" class="media-box">
<img src="{{item.link}}?action=thumbnail&width=260&algorithm=fill_proportional" alt="">
<span class="gallery-cat">{{item.description}}</span>
</a>
</div>
</li>
{% endfor -%}
it works perfectly, , pleased result, thought 1 more thing, , add picture gallery above link gallery on overview page, wanted this.
{% item in photogalleries.items %}
{module_photogallery id="{{item.id}}" template="" collection="photocollection{{item.id}}" resultsperpage="1"}
{% capture imagepath -%}{{item.id}}{% endcapture -%}
<img src="{{ photocollection['imagepath'].items[0].link }}">
<img src="{{ photocollection['item.id'].items[0].link }}">
<a href="/galleriv2?album={{item.id}}&name={{item.photogalleryname}}">gå til {{item.photogalleryname}} galleri</a><br /><br />
{% endfor -%}
i've marked things have tried, , know going make lot of calls photogallery module, if there more simple solution great, because not sure possible. found out {{ photocollection['imagepath'].items[0].link }} with brackets should possible in example shopify, doesn't seem work in bc.
so sum up, lets there 3 galleris, want call module_photogallery , make 3 different collections (this works), , target them afterwards.
the problem can liquid output correct "text" not recognize liquid because curly brackets "missing" , can't "double" brackets. (hope makes sense).
i thought in lines of: {{ photocollection{{imagepath}}.items[0].link }} curly brackets inside curly brackets won't work.
i hope explanation of problem understandable
any tips appreciated
hi,
try avoid {% capture %} possible, use {% assign %} if can.
{% capture imagepath -%}{{item.id}}{% endcapture -%}
should be
{% assign imagepath = item.id -%}
explore following bit more...
{% item in photogalleries.items %}
{module_photogallery id="{{item.id}}" template="" collection="photocollection{{item.id}}" resultsperpage="1"}
{% capture imagepath -%}{{item.id}}{% endcapture -%}
<img src="{{ photocollection['imagepath'].items[0].link }}">
<img src="{{ photocollection['item.id'].items[0].link }}">
<a href="/galleriv2?album={{item.id}}&name={{item.photogalleryname}}">gå til {{item.photogalleryname}} galleri</a><br /><br />
{% endfor -%}
try this
{% item in photogalleries.items %}
{module_photogallery id="{{item.id}}" template="" collection="photocollection" resultsperpage="1"}
{% assign imagepath = photocollection.items[0].imagepath -%} // called imagepath in galleries?
<img src="{{ imagepath }}">
<a href="/galleriv2?album={{item.id}}&name={{item.photogalleryname}}">gå til {{item.photogalleryname}} galleri</a><br /><br />
{% endfor -%}
More discussions in Developer forum
adobe
Comments
Post a Comment