[opencms-dev] multiple template-elements

Polina Smagina p.smagina at alkacon.com
Mon Feb 1 15:22:46 CET 2010


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"
> 




More information about the opencms-dev mailing list