Creating Navigation
(Difference between revisions)
(added breadcrumbs) |
|||
Line 9: | Line 9: | ||
You can create them using the CmsJspNavBuilder. Here is an example: | You can create them using the CmsJspNavBuilder. Here is an example: | ||
− | + | <code lang="Java"> | |
CmsJspActionElement element = new CmsJspActionElement(pageContext, request, response); | CmsJspActionElement element = new CmsJspActionElement(pageContext, request, response); | ||
List breadcrumbParts = element.getNavigation().getNavigationBreadCrumb(); | List breadcrumbParts = element.getNavigation().getNavigationBreadCrumb(); | ||
Line 19: | Line 19: | ||
if(el.isInNavigation()) out.print("<a href=\"" + path + "\">" + el.getNavText() +"</a> > "); | if(el.isInNavigation()) out.print("<a href=\"" + path + "\">" + el.getNavText() +"</a> > "); | ||
} | } | ||
+ | </code> |
Revision as of 15:38, 22 June 2008
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> > "); }