[opencms-dev] Properties template and template-elements

Paul-Inge Flakstad flakstad at npolar.no
Mon Mar 29 16:58:57 CEST 2010


Thanks to Michael for this excellent explanation. :-)

Cheers,
Paul

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Michael Emmerich
> Sent: 29. mars 2010 16:47
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Properties template and template-elements
> 
> Tim,
> 
> Paul-Inge Flakstad had a quite good explanation of those properties.
> 
> You must differ between xmlpages and structured xmlcontent.
> 
> Xmlpages is a quite old technology, this is something that is 
> in OpenCms 
> since the beginning.
> If you have an xmlpage, you define the template (i.e. the 
> general layout 
> of your website) which should be used in the "template" 
> property of your 
> xmlpage.
> Your template is a jsp that is located in the /templates 
> folder of your 
> module and which should contain a <cms:include element="body" 
/> where 
> "body" is the name of the content part that should be included there.
> 
> If you now load a xmlpage, OpenCms looks at the "template" 
> property of 
> this file and calls the jsp (templete) that is contained there. This 
> template jsp is then processed and the <include...> mentioned 
> above will 
> integrate the content in the produced output.
> 
> 
> Structured xmlcontent are a newer technology and were introduced with 
> OpenCms 6. To stay compatible with the older OpenCms versions, the 
> handling for those kind of resources is a bit different. Most 
> pages are 
> now build using xmlcontents.
> 
> For your xmlcontent, the "template-elements" property 
> describes which is 
> the jsp that is used to create the output for the xmlcontent. We call 
> those kind of jsps "detailpage" and they are normally located in the 
> /pages folder of your module.
> 
> Such a detail jsp mostly looks like this
> 
> [...]
> <cms:include property="template" element="head" />
> [...]
> <cms:contentload .... >
> 
> // your code to output the content of the xmlcontent is here
> 
> </cms_contentload>
> [...]
> <cms:include property="template" element="foot" />
> [...]
> 
> So when you load an structured xml content, OpenCms looks at the 
> "template-elements" property and calls the jsp (detailpage) that is 
> contained there. This jsp is processed and according to the example 
> above, it includes the "head" and "foot" part of the template 
> to put the 
> output into the correct layout of the website.
> This is done by reading the "templete" property of the structured 
> xmlcontent file.
> 
> Therefore, for a structured xmlcontent, the 
> "template-elemets" property 
> defines the detail page to display the content itself and the 
> "template" 
> property defines the general layout "around" the content.
> 
> Of course you could have the general layout in your 
> detailpage, but if 
> you use many different xmlcontent types on your website, its 
> easier to 
> define the general layout in a single template and use this in your 
> detail pages.
> 
> 
> Kind regards,
> Michael Emmerich
> 
> 
> 
> 
> 
> 
> 
> 
> Am 29.03.2010 15:33, schrieb Tim Daschner:
> > Ok thanks for the clarification. So, isn't xmlpage itself a type of
> > structured xmlcontent defined in opencms-modules.XML by 
> some module? If
> > so, then this usage of template property must come from the template
> > used by that module. In other words template is not really used by
> > opencms framework but might be used by a module that 
> alkacon may have
> > written as a part of their distro.  Did I get it right?
> >
> > Tim
> >
> >> On Mar 29, 2010 8:25 AM, "Paul-Inge Flakstad" <flakstad at npolar.no
> >> <mailto:flakstad at npolar.no>> wrote:
> >>
> >> Tim,
> >> Just to clearify: for xmlcontent ("Structured content"), the
> >> "template" property isn't used by OpenCms. But for other resource
> >> types, like xmlpage ("Page with free text"), it is used by OpenCms.
> >> As far as I can tell, the "master template" (the surrounding outer
> >> template) works in a slightly different way when working 
> with xmlpage
> >> files, compared to working with xmlcontent files:
> >> For xmlpage, the master template has some <cms:include 
> element="..."
> >> /> statements that include content from the various element(s) of
> >> the xmlpage.
> >> For xmlcontent, the master template is included from the 
> xmlcontent's
> >> template, defined in the property "template-elements".
> >> In short, xmlpage files need their "template" property 
> set, xmlcontent
> >> files need their "template-elements" property set. If done 
> correctly,
> >> you can use the same master template for both.
> >> Best regards,
> >> Paul
> >>
> >>     
> --------------------------------------------------------------
> ----------
> >>
> >>
> >>     > From: opencms-dev-bounces at opencms.org
> >>     <mailto:opencms-dev-bounces at opencms.org>
> >>     [mailto:opencms-dev-bounces at opencms.org
> >>     <mailto:opencms-dev-bounces at opencms.org>] On Behalf Of Tim D...
> >>
> >>     *Sent:* 29. mars 2010 14:59
> >>
> >>
> >>     > To: The OpenCms mailing list
> >>
> >>     *Subject:* Re: [opencms-dev] Properties template and 
> template-elements
> >>
> >>     > Thank you folks. Yeah, that's how I have used the template
> >>     elements property so far. I was not awa...
> >>
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> >
> >
> >
> > _______________________________________________
> > 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
> 
> -- 
> Kind Regards,
> Michael.
> 
> -------------------
> Michael Emmerich
> 
> Alkacon Software GmbH  - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
> 
> 
> _______________________________________________
> 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