[opencms-dev] Answer for Bread Crumbs
Pucky Loucks
pucky at how2share.com
Fri Jul 18 00:20:01 CEST 2003
After looking everywhere to find out how to do bread crumbs in OpenCMS,
I ended up locking myself in my office and did the following.
breadcrumb.jsp
<%@ page session="false"
import="com.opencms.flex.jsp.*,com.opencms.file.*" %>
<%
com.opencms.flex.jsp.CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);
com.opencms.flex.jsp.CmsJspNavBuilder cmsnav = cms.getNavigation();
java.lang.StringBuffer mystring = new StringBuffer("");
String rootFolder = "/myrootweb/";
String thisFolder = cms.getRequestContext().getFolderUri();
String thisFile = cms.getRequestContext().getFileUri();
String name;
mystring.insert(0,"<a href='" + cms.link(thisFolder + thisFile) +
"'>"+ thisFile +"</a> ");
while(true)
{
if(rootFolder.equalsIgnoreCase(thisFolder))
break;
name =
cms.getNavigation().getNavigationForResource(thisFolder).getNavText();
thisFolder =
cms.getNavigation().getNavigationForResource(thisFolder).getParentFolder
Name();
mystring.insert(0,"<a href='" + cms.link(thisFolder) + "'>" + name
+ "</a> ");
}
out.print(mystring.toString());
%>
not sure if it's the greatest, but it works.
Feedback is welcome.
Pucky Loucks
Senior Systems Architect
How2Share Technologies Inc.
More information about the opencms-dev
mailing list