silverstripe - How to create a unique name when looping through each new category? -
i need way each new category have unique name in data attribute.
below how code runs , displays:
e.g
category one
picture 1 | picture 2 | picture 3
category two
picture 1 | picture 2 | picture 3 | picture 4
category three
picture 1 | picture 2
what need when starts loop on each new category, every <a>
in servicepagesvtsliders
loop needs add 1
(or similar) data-gall="mygallery">
. way create unique group category. , when lightbox pops when link clicked cycle through particular images/iframes category instead of cycling through everything.
e.g
category one
data-gall="mygallery">
* 3 category 1
data-gall="mygallery1">
* 4 category 2
data-gall="mygallery2">
* 2 category 3
my code:
<% loop svtcategorys %> <div class="svt-service-row"> <div> <h2 class="svt-service-heading">$categoryname</h2> </div> <div> <% loop servicepagesvtsliders %> <a class="venobox_custom" data-type="iframe" href="$svtsliderlink" data-gall="mygallery"> ... (image sits in here) </a> <% end_loop %> <% end_loop %>
lightbox using: http://lab.veno.it/venobox/
you use $pos returns position of current loop. if need position of parent can use $up.pos
<% loop svtcategorys %> <div class="svt-service-row"> <div> <h2 class="svt-service-heading">$categoryname</h2> </div> <div> <% loop servicepagesvtsliders %> <a class="venobox_custom" data-type="iframe" href="$svtsliderlink" data-gall="mygallery$up.pos"> ... (image sits in here) </a> <% end_loop %> <% end_loop %>
Comments
Post a Comment