[opencms-dev] Accessing "page" content

Matthew Evans matte at solidstategroup.com
Tue Oct 14 20:15:02 CEST 2003


Hi all,

I am trying to access some content from a certain page through another JSP.
I'm basically trying to render 200 characters of a newsletter onto the
homepage as a preview.
I'm getting the first element in the list that has a navigation property and
then trying to get the content from it. It's giving me a "expecting
XMLTemplate not page" error. Any ideas?

Here's the code I'm playing with at the moment:

<%
String ROOT_NAV_CONTEXT = "/RGLIntranet/Home/CEOnewsletters/";
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();
CmsJspNavElement ne = (CmsJspNavElement)i.next();
String neName = ne.getResourceName();
String newsletter = cms.getContent(ne.getResourceName());
out.print(newsletter.substring(0,100) + "...");
out.println("<a href=\"" + cms.link(neName)+"\">");
out.println("read more</a><br>");
%>

Thanks,

M at .
 
Matthew Evans
SolidStateGroup
tel. +44 (0) 20 77402133
Mob. +44(0)7958 379562
http://www.solidstategroup.com





More information about the opencms-dev mailing list