<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:ns0 =
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE>@font-face {
font-family: Verdana;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.E-postmall17 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>This is how I do something like what you're asking
about. Lots of steps, so bear with me while I
explain....</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>Create [my-page] as 'New / Page with free
text'. In the dialogue which appears, choose as the new file's
template a JSP file which you've already created and placed in your
module's 'templates' folder. This JSP file is what OpenCms will execute
when the URL for [my-page] is invoked. You can populate the starting
content of [my-page] by choosing a file in the 'Copy body from' drop down; the
files which appear there are taken from your module's default_bodies
folder.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>As for the JSP, you want it to do what you've outlined:
contain some code (may included from a JSP snippet elsewhere) which renders
menus, and also bring in the content from [my-page]. Here's some JSP code
which does just that for me:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2><FONT color=#bf5f3f size=1>
<P align=left><FONT face="Lucida Console" size=2><%@ </FONT></FONT><FONT
face="Lucida Console"><FONT color=#3f7f7f>page </FONT><FONT
color=#7f007f>pageEncoding</FONT><FONT color=#000000>=</FONT><FONT
color=#2a00ff>"UTF-8" </FONT><FONT color=#7f007f>session</FONT><FONT
color=#000000>=</FONT><FONT color=#2a00ff>"false" </FONT><FONT
color=#7f007f>import</FONT><FONT color=#000000>=</FONT><FONT
color=#2a00ff>"<SPAN class=354510310-04102006>all your imports here"</SPAN>
</FONT><FONT color=#bf5f3f>%><BR></FONT></FONT><FONT
face="Lucida Console"><FONT color=#bf5f3f><%@ </FONT><FONT
color=#3f7f7f>taglib </FONT><FONT color=#7f007f>prefix</FONT><FONT
color=#000000>=</FONT><FONT color=#2a00ff>"cms" </FONT><FONT
color=#7f007f>uri</FONT><FONT color=#000000>=</FONT><FONT
color=#2a00ff>"http://www.opencms.org/taglib/cms" </FONT><FONT
color=#bf5f3f>%><BR></FONT></FONT></P>
<P align=left><FONT face="Lucida Console"><FONT color=#008080><</FONT><FONT
color=#3f7f7f>cms:include </FONT><FONT color=#7f007f>file</FONT><FONT
color=#000000>=</FONT><FONT color=#2a00ff>"../elements/<SPAN
class=354510310-04102006>pagecontentopen</SPAN>.jsp"</FONT><FONT
color=#008080>/></FONT></FONT></P>
<P align=left><FONT face="Lucida Console"><FONT color=#008080><</FONT><FONT
color=#3f7f7f>div </FONT><FONT color=#7f007f>class</FONT><FONT
color=#000000>=</FONT><FONT color=#2a00ff>"freeformContent"</FONT><FONT
color=#008080>><</FONT><FONT color=#3f7f7f>cms:include </FONT><FONT
color=#7f007f>element</FONT><FONT color=#000000>=</FONT><FONT
color=#2a00ff>"body"</FONT><FONT color=#008080>/></</FONT><FONT
color=#3f7f7f>div</FONT><FONT color=#008080>></FONT></FONT></P>
<P align=left><FONT face="Lucida Console"><FONT color=#008080><</FONT><FONT
color=#3f7f7f>cms:include </FONT><FONT color=#7f007f>file</FONT><FONT
color=#000000>=</FONT><FONT color=#2a00ff>"../elements/pagecontentclose.jsp"
</FONT><FONT color=#008080 size=1><FONT
size=2>/></FONT></P></FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>The included JSP paths are relative to the path of the JSP
in which this code appears, so you'll need an elements directory in your module
which contains the cited resources. In my case, these JSPs top and tail
page content; the top (pagecontentopen.jsp) renders the HTML preamble and page
header and top/left navigation; the tail (pagecontentclose.jsp) renders the page
footer and HTML closure. The <cms:include> tag in the middle is
confusingly similar, but in this case the code means 'include the XML element
named 'body' from the file referred to by the URL which caused me [this JSP] to
be invoked'.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>I've mentioned modules a few times. To create a
module of your own, create a folder named <your module name> in
/system/modules, and create JSPs etc in folders underneath
that.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006><FONT face=Arial
color=#0000ff size=2>Jon</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=354510310-04102006></SPAN> </DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B>
opencms-dev-bounces@opencms.org [mailto:opencms-dev-bounces@opencms.org] <B>On
Behalf Of </B>Felix Sprick<BR><B>Sent:</B> 04 October 2006 10:27<BR><B>To:</B>
opencms-dev@opencms.org<BR><B>Subject:</B> [opencms-dev] include html files from
templates<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi all,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have a question concerning
includes in templates. What I like to do: I want to have a “navigation panel”
that consists of several blocks with images and text (basically HTML blocks). I
want this panel included in every of my pages, that’s why I would like the
entire panel from my template on which the pages are built. My question: how do
I include the blocks (HTML pages that can be edited with WYSIWYG editor) from
/sites/default/[my-page] inside my template?? Everything I tried ended up in a
file not found exception.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Does anyone know if that’s possible
or know how to do it?<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Your help is highly
appreciated!<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Felix </SPAN></FONT><FONT
face=Verdana size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV></BODY></HTML>