[opencms-dev] oops Fix Answer to Bread Crumbs

Pucky Loucks pucky at how2share.com
Fri Jul 18 00:56:01 CEST 2003


Sorry had to swap some code around. This works great.

<%@ 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/";  //just change this to your root  
folder
     String thisFolder = cms.getRequestContext().getFolderUri();
     String thisFile = cms.getRequestContext().getFileUri();
     String name;
        if(!thisFile.equalsIgnoreCase("index.html"))
           mystring.insert(0,"  /  <a class='breadcrumb' href='" +  
cms.link(thisFolder + thisFile) + "'>"+ thisFile +"</a></p>");
     while(true)
     {
       if(rootFolder.equalsIgnoreCase(thisFolder))
          break;
     name =  
cms.getNavigation().getNavigationForResource(thisFolder).getNavText();
     mystring.insert(0,"  /  <a class='breadcrumb' href='" +  
cms.link(thisFolder) + "'>" + name  + "</a>");
     thisFolder =  
cms.getNavigation().getNavigationForResource(thisFolder).getParentFolder 
Name();
     }
     mystring.insert(0,"<p class='breadcrumbstring'><a  
class='breadcrumb' href='" + cms.link(rootFolder) + "'>Home</a>");
     out.print(mystring.toString());
%>

Pucky Loucks
Senior Systems Architect
How2Share Technologies Inc.




More information about the opencms-dev mailing list