[opencms-dev] content of called html-page can not be included intemplate

Niina Meronen niina.meronen at cidercone.com
Mon Aug 23 12:13:26 CEST 2004


Thanks Claus for the help!

 

I finally got the problem solved. The system we manage via OpenCMS is a bit
complex, so I had to struggle with properties and additional features of
files included.

 

Anyway, now the site and system work like they should! 

 

Thanks again,

Niina Meronen

-- 
Niina Meronen
Service Manager
Cidercone Wireless
Paciuksenkatu 21
FI-00270 Helsinki
phone +358 9 477 41 610
fax +358 9 477 41 666
niina.meronen at cidercone.com
 
<file:///C:\Documents%20and%20Settings\niina\Application%20Data\Microsoft\Si
gnatures\www.cidercone.com> www.cidercone.com

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Claus Priisholm
Sent: 18. elokuuta 2004 10:19
To: The OpenCms mailing list
Subject: Re: [opencms-dev] content of called html-page can not be included
intemplate 

 

I don't recall who originally made this contribution, I think you can find
it in the 2003 archives. It may have further details on the subject, and
furthermore I seem to recall fiddling a bit with the original hack to make
it fit my needs, so try to look it up if the solution below doesn't work for
you.

This is what I've used in a couple of situations where I ran into the same
problem as you, use it as you would the cms.include() method:

----8<----
public String include_hack(CmsJspActionElement cms, String uri, String
element, Map parameters) throws com.opencms.core.CmsException {
CmsXmlTemplate t = new CmsXmlTemplate();
CmsXmlTemplateFile tf = new CmsXmlTemplateFile(cms.getCmsObject(),
"/system/bodies" + uri);
if (parameters != null) {
try {
HashMap modParameterMap = new HashMap(parameters.size());
// ensure parameters are always of type String[] not just String
Iterator i = parameters.keySet().iterator();
while (i.hasNext()) {
String key = (String)i.next();
Object value = parameters.get(key);
if (value instanceof String[]) {
modParameterMap.put(key, value);
} else {
if (value == null)
value = "null";
String[] newValue = new String[] { value.toString()};
modParameterMap.put(key, newValue);
}
}
parameters = modParameterMap;
} catch (UnsupportedOperationException e) {
// parameter map is immutable, just use it "as is"
}
return tf.getProcessedTemplateContent(t, new Hashtable(parameters),
element);
} else {
return tf.getProcessedTemplateContent(t, null, element);
}
}
----8<----
Claus

OpenCms links & API's: http://www.codedroids.com/community/opencms
--
Claus Priisholm
+45 48 22 46 46
cpr <you know what> codedroids.com
http://www.codedroids.com



On 17/8-2004, at 13.07, Niina Meronen wrote:

Hi everybody,

 

I found a question below from the mail archive when struggling with similar
problem but there were no answers. So, is there anybody who knows the reason
or can explain how to avoid that problem? In my case we are using OpenCMS
5.0.1., and the problem is that the content of file that is called (usually
index.html) is replaced by previous file's content (smaller position in
navigation). In other words, previous file's content is shown twice when
trying to include several html-pages in one template. The only exception is
when the file that is called is the first one in navigation, then the
content of all the files is shown correctly!

 

I would really apreciate the answer, thanks in advance!

 

Niina Meronen

---

 

Frank Wunderlich k.frank.wunderlich at gmx.de 
Mon Jun 2 18:55:01 CEST 2003 
. Previous message: [opencms-dev] projectId of tempfileproject
. Next message: [opencms-dev] Deleting old folders during sync
. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] 

Hi,
 
I've got the following problem:
 
I have got a master-jsp-template, that shall dynamically include other
html-pages (resp. page-fragments), that have their own jsp-template.
That means, both, the including and the included page are editable via
opencms.
 
Unfortunatly the bodycontent of the main-page is not accessible anymore,
after I have included the other page.
Instead of showing the bodycontent of the main-page, the bodycontent of
the included page is shown again.
 
Example:
 
<cms:include element="body" />              // The correct bodycontent
of my page is displayed
<% cms.include(otherEditableHtmlFile); %>   // The content of the
included page is displayed 
<cms:include element="body" />              // The content of the
included page is shown again!! 
 
Looks like some unwanted sideeffect to me...
Or am I doing something the wrong way?
 
Thanks in advance,
Frank.

 

 

-- 
Niina Meronen
Service Manager
Cidercone Wireless
Paciuksenkatu 21
FI-00270 Helsinki
phone +358 9 477 41 610
fax +358 9 477 41 666
niina.meronen at cidercone.com
www.cidercone.com

 


_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040823/63bc7a74/attachment.htm>


More information about the opencms-dev mailing list