Creating Navigation

From OpenCms Wiki
Revision as of 15:38, 22 June 2008 by Euku (Talk | contribs)
Jump to: navigation, search

Most people use CmsJspNavBuilder to create navigation menus on the fly.

Breadcrumbs

Breadcrumbs are a trail of links that indicate where you are in the hierarchy. They look like: Home >> About >> Staff

So you would know you were in the about section, looking at staff pictures.

You can create them using the CmsJspNavBuilder. Here is an example:

 CmsJspActionElement element = new CmsJspActionElement(pageContext, request, response);
 List breadcrumbParts = element.getNavigation().getNavigationBreadCrumb();
 Iterator i = breadcrumbParts.iterator();
 String path = "";
 while(i.hasNext()) {
         CmsJspNavElement el = (CmsJspNavElement)i.next();
         path += el.getFileName();
         if(el.isInNavigation()) out.print("<a href=\"" + path + "\">" + el.getNavText() +"</a> > ");
 }
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox