[opencms-dev] multiple template-elements
Roman Uhlig Maxity.de
roman.uhlig at maxity.de
Mon Feb 1 16:14:58 CET 2010
Hello Polina,
thank you very much for that info. Sounds like exactly the thing we need. I've never heard or read about this "default_bodies" mechanism, neither in the doc nor in the wiki. Good to know! ;)
Btw, we just managed to handle it by using includeSilent() instead of include(), so missing include-elements won't throw an error. But your suggestion is much better, we'll try that instead.
Kind regards,
Roman
-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Polina Smagina
Gesendet: Montag, 1. Februar 2010 15:23
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] multiple template-elements
Hello Roman,
try to add your own default body file to your module.
When creating a new XML page using the "New" wizard the user selects a
"default body" to copy to the new resource.
This "default body" contains a preset XML structure corresponding to the
page XML elements. In default case only the first element will be created.
Default bodies are text files that have to be placed in a subfolder
named "default_bodies" of an OpenCms module folder. For following
template-elements:
"text1*|Text,images*|Images,title*|Title"
the content of the file can look like this:
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.opencms.org/dtd/6.0/xmlpage.xsd">
<page language="de">
<element name="text1">
<links/>
<content/>
</element>
<element name="images">
<links/>
<content/>
</element>
<element name="title">
<links/>
<content/>
</element>
</page>
<page language="en">
<element name="text1">
<links/>
<content/>
</element>
<element name="images">
<links/>
<content/>
</element>
<element name="title">
<links/>
<content/>
</element>
</page>
</pages>
The default body file should have a Title property as a nice name.
--
Kind Regards,
Polina
-------------------
Polina Smagina
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
Roman Uhlig Maxity.de schrieb:
>
> Hello Polina,
>
> thanks for the reply.
>
> Yes, I know the "ifexists" option of the <cms:template> tag. But what I meant is the handling when including such a page with <cms:include>, e.g. from inside a JSP. I can't use <cms:template> there (at least I'm getting an error when trying).
>
> Kind regards,
> Roman
>
>
> -----Ursprüngliche Nachricht-----
> Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Polina Smagina
> Gesendet: Montag, 1. Februar 2010 12:57
> An: The OpenCms mailing list
> Betreff: Re: [opencms-dev] multiple template-elements
>
> Hello Roman,
>
> to controll the inclusion of the page elements in the template the
> <cms:template> tag with "ifexists" can be used.
>
> Example for the inclusion of an optional page element in the template code:
> <cms:template ifexists="body2">
> <cms:include element="body2" editable="true" />
> </cms:template>
>
> Other possible conditions:
>
> ifexistsone="element1,element2,...,elementN"
> ifexistsnone="element1"
> ifexistsall="element1,element2,...,elementN"
>
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list