Does anyone know why the code below is outputting 2 of each navigation element.
//get the full path to the current page
String home = Text.getAbsoluteParent(currentPage.getPath(), 2);
int absParent = currentStyle.get("absParent", 1);
//checks for invalid and hidden pages.
PageFilter filter = new PageFilter(request);
//utility class that provides an iterator over navigation elements
Navigation nav = new Navigation(currentPage, absParent, filter, 1);
for (Navigation.Element i: nav) {
%><li <%= i.hasChildren() %>><a href="<%= i.getPath() %>.html"><%= i.getTitle() %></a> <%
break;
}
But if I add in a switch statement within the for loop it displays 1 of each navigation element like it should.
for (Navigation.Element i: nav) {
switch (i.getType()) {
case ITEM_BEGIN:
%><li <%= i.hasChildren() %>><a href="<%= i.getPath() %>.html"><%= i.getTitle() %></a><%
break;
}
}
This is driving me crazy, any help is greatly appreciated! Thanks!