[opencms-dev] Is it possible to include titles and links fromother pages into a page?

M Butcher mbutcher at grcomputing.net
Mon Sep 1 22:16:01 CEST 2003


You need to make sure that the navigation properties are set for the
JSP. For an example, look at the properties of a Page. I think navPos is
the main property used for building navigation.

Matt

On Mon, 2003-09-01 at 08:09, Matthew Evans wrote:
> Matt,
> 
> Again thanks for the code below.
> I've got it working well on my dev site.
> 
> I have a question about the file that it sits in though.
> If I put this JSP code in a JSP file in the same directory as the pages it
> references, I can't seem to set the JSP page into the navigation.
> Is this the inherent functionality of OpenCMS? That JSP files cannot apear
> in the navigation? Or do you have to set the properties for JSP pages
> manually?
> 
> Thanks again.
> 
> M at . 
> 
> 
>  
> Matthew Evans
> SolidStateGroup
> tel. +44 (0) 20 77402133
> Mob. +44(0)7958 379562
> http://www.solidstategroup.com
> 
> 
> -----Original Message-----
> From: opencms-dev-admin at opencms.org [mailto:opencms-dev-admin at opencms.org]
> On Behalf Of M Butcher
> Sent: 29 August 2003 20:03
> To: opencms-dev at opencms.org
> 
> You will probably have to write a little bit of JSP Java to do this, but I
> think that all you'd have to do is get the navigation for those directories.
> 
> If you haven't already read the documentation on the JSP script objects
> (CmsJspActionElement, CmsNavElement, etc.) you will probably want to use
> that. Here's a script that prints all of the links inside a directory. I use
> it to create navigation bars (Note: change ROOT_NAV_CONTEXT to your
> dir):
> 
> <%@ page import="java.util.*, com.opencms.flex.jsp.*" %> <%
> /*
>  * Author: M Butcher (mbutcher at AT@grcomputing at DOT@net)
>  * License: GPL v.2 or higher (at your option)  */ CmsJspActionElement cms =
> new CmsJspActionElement(pageContext, request, response);
> 
> // This is where the menu should start building.
> String ROOT_NAV_CONTEXT = "/my_vfs_dir/";
> 
> String filename = cms.getRequestContext().getUri(); String foldername =
> com.opencms.file.CmsFile.getPath(filename);
> 
> ArrayList navItems =
> cms.getNavigation().getNavigationForFolder(ROOT_NAV_CONTEXT);
> Iterator i = navItems.iterator();
> 
> while (i.hasNext()) {
>     CmsJspNavElement ne = (CmsJspNavElement)i.next();
>     String neName = ne.getResourceName();
>     if(neName.equals(foldername)) {
>         out.println("<span class=\"main-menu-link-followed\">" +
> ne.getTitle() + "</span><br>");
>     } else {
>         out.println("<a class=\"main-menu-link\" href=\"" +
> cms.link(neName)+"\">");
>         out.println(ne.getTitle() + "</a><br>");
>     }
> }
> 
> /*
> // If you uncomment this section, it will also conditionally add a link //
> to the home page -- nice if you are doing a menu.
> if(!"/".equals(foldername)) {
>     out.println("<p class=\"main-menu-home\">");
>     out.println("<a class=\"main-menu-home-link\" href=\""+cms.link("/")
>       + "\">Home</a></p>");
> }
> */
> 
> %>
> 
> Hope that helps,
> 
> Matt
> 
> On Fri, 2003-08-29 at 05:27, Matthew Evans wrote:
> > Hi,
> > 
> > I'm just starting a site with OpenCMS and I've been through all the 
> > jsp tutorials.
> > It seems like theres going to be a lot of JSP includes going on in my
> site.
> > 
> > I want to have a page that lists all the recent newsletters sent from 
> > my site.
> > Each newsletter is going to be stored in openCMS as an HTML page in a 
> > "newsletter" directory.
> > 
> > I then want a "newsletters" page to have a dynamically generated list 
> > of links to view all the previous newsletters held in the newsletter
> directory.
> > 
> > In other CMS's I've been able to do this with tags in the jsp like:
> > <cms:articles type="newsletters">
> > <cms:article asset="description"/>
> > </cms:articles>
> > 
> > I can't see a way of doing this easily in OpenCMS though.
> > Any ideas?
> > 
> > Thanks.
> > 
> > M at .
> > 
> > 
> >  
> > Matthew Evans
> > SolidStateGroup
> > tel. +44 (0) 20 77402133
> > Mob. +44(0)7958 379562
> > http://www.solidstategroup.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
> --
> M Butcher <mbutcher at grcomputing.net>
> _______________________________________________
> 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 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
-- 
M Butcher <mbutcher at grcomputing.net>



More information about the opencms-dev mailing list