[opencms-dev] Get all folders

Frans Postma fpostma at xs4all.nl
Sat Apr 9 00:23:55 CEST 2005


 Oliver,

Indexing refers usually to search-indexes, which you don't need for Navigation as far as I know. Could you please post the
relevant part of code you attempt to execute?

The "welcome" template in opencms6b1 is a good and simple example for this. Look at
/system/modules/welcome/elements/welcome_nav.jsp

The shortest example of navigation use I can come up with is something like this (check out the javadoc for
org.opencms.jsp.CmsJspNavBuilder method getSiteNavigation() for other call options):

//start
// must be on a jsp page, quick example.. not tested

// Create a JSP action element
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);

// yes you can use the static call too, 
// I prefer getNav from a known object to force-check stuff :)	 
java.util.List list = cms.getNavigation().getSiteNavigation();
java.util.Iterator i = list.iterator();

// Now build the navigation
out.println("Navigation:<br>");
while (i.hasNext()) {
    	CmsJspNavElement ne = (CmsJspNavElement)i.next();
	out.print(ne.getNavText()); // never returns null, so this is safe
	out.println("<br>");
}
out.println("end nav entries<br>");
// end example

Have fun with it and READ the javadocs, those contain the most of the opencms6 documentation! Some HowTo's and guides would be
nice yes, but all methods and such are very nicely documented in the source itself. (you might need to get 6b1 for the full
documentation, seems 6b2 doesn't have that in the zip anymore?)

Frans

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Oliver Pereira
> Sent: vrijdag 8 april 2005 18:38
> To: The OpenCms mailing list
> Subject: RE: [opencms-dev] Get all folders
> Importance: High
> 
> Thanks, it worked
> 
> Now I am havin problems implementing the search
> 
> I cannot find any icon in the administration to index the site, hence
> how do I index ths site
> 
> Because the catalogue is not present I am getting the following error
> 
> javax.servlet.ServletException:
> org.opencms.file.CmsObject.readAncestor(Ljava/lang/String;I)Lo
> rg/opencms
> /file/CmsFolder;
> 	at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContex
> tImpl.java:536)
> 
> Regards,
> 
> Oliver
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of 
> Alexander Kandzior
> Sent: 06 April 2005 18:39
> To: 'The OpenCms mailing list'
> Subject: RE: [opencms-dev] Get all folders
> 
> 
> That one should do the job:
> 
> org.opencms.jsp.CmsJspNavBuilder
> 
> /**
>  * This method builds a complete navigation tree with entries of all
> branches
>  * from the specified folder.<p>
>  *
>  * @see #getSiteNavigation(CmsObject, String, int)
>  *
>  * @param folder folder the root folder of the navigation tree.
>  * @param endLevel the end level of the navigation.
>  * @return ArrayList of CmsJspNavElement, in depth first order.
>  */
> public List getSiteNavigation(String folder, int endLevel) 
> 
> Best Regards,
> Alex.
> 
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
> 
> 
>  
> 
> 
> ________________________________
> 
> 	From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Oliver Pereira
> 	Sent: Wednesday, April 06, 2005 6:11 PM
> 	To: The OpenCms mailing list
> 	Subject: [opencms-dev] Get all folders
> 	Importance: High
> 	
> 	
> 
> 	Hi, 
> 
> 	I am trying to get the navigation of a folder and it's
> subfolders, Is there any method similar to getNavigationFolder which
> will get me the navigation of all the subfolders under the parent
> folder, irrespective of the no of subfolders.
> 
> 	For e.g. 
> 
> 	A       -> B 
> 	        -> C 
> 
> 	The method should return B and C both 
> 
> 	Regards, 
> 
> 	Oliver 
> 
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To change
> your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> _____________________________________________________________________
> This e-mail has been scanned for viruses by MCI's Internet Managed
> Scanning Services - powered by MessageLabs. For further information
> visit http://www.mci.com
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list