[opencms-dev] question about template problem

Andy Kriger akriger at greaterthanone.com
Wed Sep 29 21:37:59 CEST 2004


A followup to this problem. If I use JSPs instead of HTMLs for the included
pages, then I do not have the problem and I see the expected
 
Include File 1
This is some text
Include File 2
 
Looking in opencms.log, for the HTML version I see
 
[29.09.2004 15:40:28] <opencms_elementcache> [CmsElementXml
(CmsXmlTemplate/inc1.html)] Varia
nt
"key_http_body._TEMPLATESELECTOR_=default;body._TEMPLATE_=/system/bodies/gto
/inc1.html;bod
y._CLASS_=com.opencms.template.CmsXmlTemplate;" is not in element cache. 
[29.09.2004 15:40:28] <opencms_elementcache> [CmsElementXml
(CmsXmlTemplate/inc1.html)] addin
g variant
"key_http_body._TEMPLATESELECTOR_=default;body._TEMPLATE_=/system/bodies/gto
/inc1.h
tml;body._CLASS_=com.opencms.template.CmsXmlTemplate;" to cache. 
[29.09.2004 15:40:28] <opencms_elementcache> [CmsElementXml
(CmsXmlTemplate/bodyloader)] gett
ing variant "key_http_" from cache. 
[29.09.2004 15:40:28] <opencms_elementcache> [CmsElementXml
(CmsXmlTemplate/inc1.html)] getti
ng variant
"key_http_body._TEMPLATESELECTOR_=default;body._TEMPLATE_=/system/bodies/gto
/inc1.
html;body._CLASS_=com.opencms.template.CmsXmlTemplate;" from cache. 
 
The inc1.html file is added twice into the file. I think maybe this is
because body._TEMPLATE_ is not being reset to the body of the templated file
between <cms:include page=""/> and <cms:include element="body"/>. What I am
wondering now, if anyone familiar with the internals of OpenCms knows - how
can I reset the context of the include tag from the included inc1.html to
the templated page?


  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Andy Kriger
Sent: Wednesday, September 29, 2004 12:41 PM
To: 'The OpenCms mailing list'
Subject: [opencms-dev] question about template problem



In this template... 

<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %> 
<html><head></head><body> 
<cms:include page="/gto/inc1.html"/><br> 
<br> 
<cms:include element="body"/><br> 
<br> 
<cms:include page="/gto/inc2.html"/><br> 
<br> 
</body></html> 

/gto/inc1.html and /gto/inc2.html are files in the same directory as the
page that is using this template, containing the text "Include File 1" or
"Include File 2". The page using the template has a body of "This is some
text". 

Viewing the page using the template, I would expect to see 
Include File 1 
This is some text 
Include File 2 

When I view this page, I see 
Include File 1 
Include File 1 
Include File 2 

If I move the <cms:include element="body"/> tag before the first include,
then I see 
This is some text 
Include File 1 
Include File 2 

So the body text of the page is definitely able to be found but the order of
include tags seems to affect things. Can anyone tell me why the inc1.html is
being duplicated? And how I might workaround this problem?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040929/7335cf10/attachment.htm>


More information about the opencms-dev mailing list