Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<%@include file="/libs/foundation/global.jsp"%>
<%@page import="java.lang.Iterable"%>
<%@page session="false" %>
<%
String bestsellerPath = "/content/geometrixx/en/products/bestsellers/jcr:content/par/";
Iterable<Resource> bestsellers = resourceResolver.getResource(bestsellerPath).getChildren();
int index = 0;
for (Resource bestseller : bestsellers) {
if (index % 2 == 0){
%>
<div class="parsys_column cq-colctrl-lt0">
<%
}
%>
<div class="parsys_column cq-colctrl-lt0-c<%= index % 2 %>">
<sling:include path="<%= bestseller.getPath() %>" />
</div>
<%
if (index % 2 == 1){
%>
</div>
<%
}
index++;
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment