<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.51">
<TITLE>Dynamic Loading of Page path for content using iframes</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Tahoma">HELP!</FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">I have built a template (<B>/opencms/opencms/system/modules/ca.mb.brandonrha.www/templates/brandonrha_main</B>) 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=<B> /opencms/opencms/system/modules/ca.mb.brandonrha.www/jsptemplates/navigation</B>).</FONT></P>
<P><FONT SIZE=2 FACE="Tahoma"><%@ page session="false" import="java.util.Iterator,</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">java.util.List,</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">org.opencms.jsp.CmsJspNavBuilder,</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">org.opencms.jsp.CmsJspNavElement,</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">org.opencms.jsp.CmsJspActionElement"</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">%></FONT>
<BR><FONT SIZE=2 FACE="Tahoma"><%</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);</FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">CmsJspNavBuilder nav = cms.getNavigation();</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">List navItems = nav.getNavigationForFolder();</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">Iterator i = navItems.iterator();</FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">while (i.hasNext()) {</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">CmsJspNavElement navElement = (CmsJspNavElement)i.next();</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">String myLink = cms.link(navElement.getResourceName());</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">String myTitle = navElement.getFileName();</FONT>
<BR> <FONT SIZE=2 FACE="Tahoma">out.println("<a href=\"" + myLink + "\">" + myTitle + "</a><br/>");</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">}</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">%></FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">IT WORKS GREAT!!! Pulls out all the paths to every file located in</FONT><B> <FONT SIZE=2 FACE="Tahoma">/opencms/opencms/sites/brandonrha/</FONT></B>
</P>
<P><FONT SIZE=2 FACE="Tahoma">BUT, if I use the same basic code (template located</FONT><B> <FONT SIZE=2 FACE="Tahoma">/opencms/opencms/system/modules/ca.mb.brandonrha.www/jsptemplates/body</FONT></B><FONT SIZE=2 FACE="Tahoma">) to find the path dynmically, for example, a page called</FONT><B> <FONT SIZE=2 FACE="Tahoma">/opencms/opencms/sites/brandonrha/main.html</FONT></B><FONT SIZE=2 FACE="Tahoma">, the path defaults when the page is loaded to</FONT><B> <FONT SIZE=2 FACE="Tahoma">/opencms/opencms/system/modules/ca.mb.brandonrha.www/templates/main.html</FONT></B><FONT SIZE=2 FACE="Tahoma">. This isn't where main.html is, it's where my master template is located. And I opened the page from</FONT><B> <FONT SIZE=2 FACE="Tahoma">/opencms/opencms/sites/brandonrha/main.html</FONT></B></P>
<P><FONT SIZE=2 FACE="Tahoma">Why does the navigation find the correct path, but not the body template code?</FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">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" />)</FONT></P>
<P><FONT SIZE=2 FACE="Tahoma">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.</FONT></P>
<P><FONT SIZE=2 FACE="Tahoma">Any ideas?</FONT>
</P>
<P><FONT SIZE=2 FACE="Tahoma">Tomcat 5.0.28</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">MySql 3.23</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">Linux 2.4.20-8</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">Opencms 6 aplha 2</FONT>
<BR><FONT SIZE=2 FACE="Tahoma">Java 1.4.2_06</FONT>
</P>
<P><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Clayton Corbey</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">IT Analyst/Programmer</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Brandon Regional Health Authority</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">150 McTavish Ave. East</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Brandon, Manitoba, Canada</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">R7A 2B3</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">corbeyc@brandonrha.mb.ca</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Ph: +1 (204) 726 2656</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Page: +1 (204) 571 8229</FONT>
<BR><FONT COLOR="#FF0000" SIZE=1 FACE="Verdana">Fax: +1 (204) 726 2447</FONT>
</P>
</BODY>
</HTML>