Creating Navigation
(Difference between revisions)
(added breadcrumbs) |
|||
Line 1: | Line 1: | ||
Most people use CmsJspNavBuilder to create navigation menus on the fly. | 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> > "); | ||
+ | } |
Revision as of 16:28, 28 June 2007
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> > "); }