[opencms-dev] Dynamic Loading of Page path for content using iframes

Corbey, Clayton CorbeyC at brandonrha.mb.ca
Wed Nov 17 18:53:50 CET 2004


HELP!

I have built a template
(/opencms/opencms/system/modules/ca.mb.brandonrha.www/templates/brandonrha_m
ain) for a new site using OpenCMS 6 Aplha 2. I have built a dynamic menu
that is called by my template using the following code (path=
/opencms/opencms/system/modules/ca.mb.brandonrha.www/jsptemplates/navigation
).

<%@ page session="false" import="java.util.Iterator,
				java.util.List,
				org.opencms.jsp.CmsJspNavBuilder,
				org.opencms.jsp.CmsJspNavElement,
				org.opencms.jsp.CmsJspActionElement"
%>
<%
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);

CmsJspNavBuilder nav = cms.getNavigation();
List navItems = nav.getNavigationForFolder();
Iterator i = navItems.iterator();

while (i.hasNext()) {
	CmsJspNavElement navElement = (CmsJspNavElement)i.next();
	String myLink = cms.link(navElement.getResourceName());
	String myTitle = navElement.getFileName();
	out.println("<a href=\"" + myLink + "\">" + myTitle + "</a><br/>");
}
%>

IT WORKS GREAT!!! Pulls out all the paths to every file located in
/opencms/opencms/sites/brandonrha/

BUT, if I use the same basic code (template located
/opencms/opencms/system/modules/ca.mb.brandonrha.www/jsptemplates/body) to
find the path dynmically, for example, a page called
/opencms/opencms/sites/brandonrha/main.html, the path defaults when the page
is loaded to
/opencms/opencms/system/modules/ca.mb.brandonrha.www/templates/main.html.
This isn't where main.html is, it's where my master template is located. And
I opened the page from /opencms/opencms/sites/brandonrha/main.html

Why does the navigation find the correct path, but not the body template
code?

I'm using an iframe and I need the path to the actual Page file so it can
load what's inside into the iframe (<iframe
src="/opencms/opencms/sites/brandonrha/main.html" />)

If I hard code the src= path, it says resource not found, even though it is
there. I know I'm so close b/c I can use a <cms:include element="text1" />
and the content from the respective file gets loaded... but I need the
relative path, not the content for the iframe.

Any ideas?

Tomcat 5.0.28
MySql 3.23
Linux 2.4.20-8
Opencms 6 aplha 2
Java 1.4.2_06

Clayton Corbey
IT Analyst/Programmer
Brandon Regional Health Authority
150 McTavish Ave. East
Brandon, Manitoba, Canada
R7A 2B3
corbeyc at brandonrha.mb.ca
Ph: +1 (204) 726 2656
Page: +1 (204) 571 8229
Fax: +1 (204) 726 2447

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20041117/0de6855a/attachment.htm>


More information about the opencms-dev mailing list