0

in my openCMS project, content folders are named by years:

  • 2010
  • 2011
  • 2012
  • 2013

I use

CmsJspNavBuilder navigation = a_cms.getNavigation();
List navItems = navigation.getSiteNavigation(a_rootFolder,99);

to create a list of all these folders. How do I print the whole list item by item?

Thanks!

1 Answers1

0

I suggest to use the taglibs instead of java code, it's cleaner. See the sample right there:

http://www.opencms-wiki.org/wiki/The_OpenCms_8_Demo_Template_Modules_in_Detail#Navigation_tag

 <cms:navigation type="forFolder" startLevel="0" endLevel="1" var="nav"/>
   <c:forEach items="${nav.items}" var="elem">
     <c:set var="currentLevel" value="${elem.navTreeLevel}" />
     […]
     <a href="<cms:link>${elem.resourceName}</cms:link>">
       ${elem.navText}
     </a>
   </c:forEach>
 </cms:navigation>

From the wiki:

The tag provides access to the navigation information. The tag is described in the /WEB-INF/opencms.tld OpenCms tag library descriptor (TLD). A Web Container (e.g. Tomcat) uses TLDs to validate tags. The opencms.tld describes the custom OpenCms tag library.

The navigation tag has six attributes:

  • var (required)
  • type(required) can be set to treeForFolder, forFolder, forSite, forResource, breadCrumb
  • startLevel (optional) that reads the property "NavStartLevel" on resource or folder
  • endLevel (optional)
  • resource
  • param (optional).

Using the navigation tag in a JSP invokes the core method org.opencms.jsp.CmsJspTagNavigation used to access OpenCms VFS navigation information on a JSP with the EL.

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192