Created
October 21, 2013 11:12
-
-
Save UberNick/7082193 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@include file="/libs/foundation/global.jsp"%> | |
<%@page import="java.util.Iterator"%> | |
<%@page session="false" %> | |
<% | |
String offsetString = (String)request.getParameter("offset"); | |
String limitString = (String)request.getParameter("limit"); | |
if (null == offsetString) { | |
offsetString = "0"; | |
} | |
if (null == limitString) { | |
limitString = "4"; | |
} | |
int offset = Integer.parseInt(offsetString); | |
int limit = Integer.parseInt(limitString); | |
String bestsellerPath = "/content/geometrixx/en/products/bestsellers/jcr:content/par/"; | |
Iterable<Resource> bestsellers = resourceResolver.getResource(bestsellerPath).getChildren(); | |
int index = -1; | |
for (Resource bestseller : bestsellers) { | |
index++; | |
if (limit > 0 && index >= limit) { | |
break; | |
} | |
if (offset > index) { | |
continue; | |
} | |
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> | |
<% | |
} | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment