<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>Hi Yogesh</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>Like Eska was pointing out, it is important to use
correct file names. In your property, you should put the entire site path of
your tip file, like so:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>/mylocale/myfolder/myfile.html</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>NOT like so:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>/opencms/opencms/sites/sitename/mylocale/myfolder/myfile.html</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>/sites/sitename/mylocale/myfolder/myfile.html</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>I have tested your situation, and here's a solution
(tested, works):</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010>In your <cms:template element="insider_tip">,
place this to include the xmlpage tip file, replacing all your scriptlet code
there:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=407063810-12022010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT
size=2><cms:include element="body"><cms:property name="<SPAN
class=407063810-12022010>tip_</SPAN>file" /></cms:include><SPAN
class=407063810-12022010><!-- you'll need to put the tip file's entire site
path in the property tip_file --></SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>Make sure you change the element="body" to match your
xmlpage element.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>Alternatively:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>keep your scriptlet code as it was, but replace the last
scriptlet line to:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2><cms:include file="<%= cms.property("tip_file")
%>" element="body" /><!-- if the tip file's entire site path is in
the property --> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>or</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2><cms:include
file="<%= foldername.concat(cms.property("tip_file")) %>"
element="body" /><!-- if only the tip file name, not the complete
site path, is in the property --></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>HTH.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=407063810-12022010><FONT face=Arial
color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-bounces@opencms.org
[mailto:opencms-dev-bounces@opencms.org] <B>On Behalf Of </B>Yogesh
Mujumdar<BR><B>Sent:</B> 12. februar 2010 10:51<BR><B>To:</B> The OpenCms
mailing list<BR><B>Subject:</B> Re: [opencms-dev] include xmlpage content from
template<BR></FONT><BR></DIV>
<DIV></DIV>Hi Paul,<BR><BR>Part of the stacktrace is here ..<FONT size=4><BR
style="FONT-FAMILY: courier new,monospace"><BR
style="FONT-FAMILY: courier new,monospace"></FONT>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid; FONT-FAMILY: courier new,monospace"><PRE><PRE><FONT size=4><FONT size=4>javax.servlet.ServletException: javax.servlet.jsp.JspException: Error reading resource from path "/opencms/opencms/TAIG/personal/MyTip1.html".<BR> at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)<BR>
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)<BR> at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.com_viral_taig_TemplatesV2.templates.Rural_005fV2_jsp._jspService(Rural_005fV2_jsp.java:265)<BR>
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)<BR> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)</FONT><BR></FONT></PRE></PRE></BLOCKQUOTE><BR>I
made a xmlpage type file and put some content in it. Applied my template to it
by selecting the template dropdown. Then I defined a property by name
<B>tip_file</B> by clicking the Advanced button. The property is set to a
xmlpage type of file created in the same VFS directory, e.g,
mytip.html.<BR><BR>Both the file and the tip file are located in the same site
directory <BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><FONT
size=2>/opencms/opencms/TAIG/personal/</FONT><BR></BLOCKQUOTE><PRE><PRE><FONT size=+0><FONT size=4><BR></FONT></FONT></PRE></PRE>The template has
the following line...<BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><cms:include
file="../elements/commons_v2.jsp" element="insider_tip"/><BR></BLOCKQUOTE>
<DIV><BR>The included elements file has the code....<BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><cms:template
element="insider_tip"> <BR> <div
class="rightnav_content_head"><img<BR>
src="<cms:link>../resources/images/right_nav.gif</cms:link>"
width="8"<BR> height="8" /> Insider
Tip</div><BR> <div
class="rightnav_div1"><!-- --></div><BR>
<div class="rightnav_content"><BR>
<%<BR>
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);<BR>
String filename = cms.getRequestContext().getUri();<BR>
String foldername =
org.opencms.file.CmsResource.getFolderPath(filename);<BR>
String tfilename =
cms.property("tip_file", filename);<BR>
cms.include(cms.link(foldername +
tfilename));<BR> %><BR>
<br /><BR> <input
type="image"<BR>
src="<cms:link>../resources/images/find_out_more.gif</cms:link>"<BR>
width="107"
height="28"></div><BR></cms:template><BR></BLOCKQUOTE>
<DIV><BR> </DIV><BR> <BR></DIV><BR>-- Yogesh<BR><BR>Believe with all
your heart that how you live your life makes a difference. --Colin Beavan
<BR><BR><BR>
<DIV class=gmail_quote>On Fri, Feb 12, 2010 at 3:02 PM, Paul-Inge Flakstad
<SPAN dir=ltr><<A
href="mailto:flakstad@npolar.no">flakstad@npolar.no</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Hi
Yogesh</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Unless
you want to use hard coded file names, using properties such
a job sounds about right.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Can you
paste the complete error message? Also, please inform what you set the
property value to, and where the tip file is located.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I
suspect that you will need to use a JSP file - typically the tip_file's
template (which is usually found as the property
template-elements) - to render the content of your tip file. You
would then include this JSP file inside your template code, not the tip
file itself. </FONT></SPAN><SPAN><FONT face=Arial color=#0000ff size=2>Note
that I am not totally sure of this, as I rarely use the xmlpage
myself.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Best
regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Paul</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,255) 2px solid; MARGIN-RIGHT: 0px">
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
href="mailto:opencms-dev-bounces@opencms.org"
target=_blank>opencms-dev-bounces@opencms.org</A> [mailto:<A
href="mailto:opencms-dev-bounces@opencms.org"
target=_blank>opencms-dev-bounces@opencms.org</A>] <B>On Behalf Of
</B>Yogesh Mujumdar<BR><B>Sent:</B> 12. februar 2010 09:34<BR><B>To:</B>
<A href="mailto:opencms-dev@opencms.org"
target=_blank>opencms-dev@opencms.org</A><BR><B>Subject:</B> [opencms-dev]
include xmlpage content from template<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV>Dear All,<BR><BR>I have a simple template which is supposed to
show the page content. The template has a Tips section where I need to
display tips. These requirement is that the tips have to be editable at
page level. Tips will be HTML content(<B>xmlpage</B>). <BR><BR>The
solution that I came across(<B>which does not work</B>) was to define a
property called as <B>tip_file</B> for every page and specify a file name
which needs to be shown as a tip. In the template I get the
property(<B>tip_file</B>) of the page and make a URI to the file using the
context uri and foldername and the tip filename. I then include this file
in the template with include method of CmsJspActionElement object. When I
view the file with <B>tip_file</B> property set to some <B>xmlpage</B>, I
get and error which says <B>"/opencms/opencms/test/mytip.html"</B> is not
accessible, though it is available in the folder and is accessible if
viewed independently.<BR><BR>Any other quick and smart way of doing
it?<BR><BR clear=all>-- Yogesh<BR><BR>Believe with all your heart that how
you live your life makes a difference. --Colin Beavan
<BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR>_______________________________________________<BR>This
mail is sent to you from the opencms-dev mailing list<BR>To change your list
options, or to unsubscribe from the list, please visit<BR><A
href="http://lists.opencms.org/mailman/listinfo/opencms-dev"
target=_blank>http://lists.opencms.org/mailman/listinfo/opencms-dev</A><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>