[opencms-dev] Re: opencms-dev Digest, Vol 109, Issue 4
Joe Lam
joe.lam at moni-media.net
Fri Sep 8 04:23:05 CEST 2006
just to share my experience. hope this helps.
template property is like the global layout of pages within a site. I
use template to define (store) the header, navigation menu, sidebar, the
box to contain main content and the footer.
this is the basic codes of a template
if (cms.template("head")) {
...
} // end of head template
if (cms.template("content")) {
...
}
if (cms.template("foot")) {
...
}
the template-element property is used to display the inner content.
for a structured xml content, the default template-element property is
set in modules.xml
<property>
<name>template-elements</name>
<value
type="shared"><![CDATA[/system/modules/module-name/whateverfolder/detail_typename.jsp]]></value>
</property>
the detail jsp looks like this
<cms:include property="template" element="head" />
<cms:contentload collector="singleFile"
param="${pageContext.detailfile}" editable="true">
... show content stuff ...
</cms:contentload>
<cms:include property="template" element="foot" />
for each structured content, I have one detail jsp whose job is to
display the specific content type. this jsp's main job is playing (grab
data from the outer type and the nested type) with the fields in the xml
content and then display them in customized way. I use scriptlet instead
of tablib to do this. more flexible.
for me, xmlpage doesnt need template-element property, just put content
in body element. the template jsp will make use of the body element
automatically. (thanks to templateOne)
Joe
> Thanks that helps. So, does this replace the template property,
> assuming I have a master template setup, or is it used in conjunction
> with the template-elements?
>
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
> Sent: Tuesday, September 05, 2006 10:45 PM
> To: 'The OpenCms mailing list'
> Subject: RE: [opencms-dev] template-element property
>
> If you set the template-elements property on an XML resource to the path
> of
> a JSP (usually one held within a module), than page views of the URL
> corresponding to the XML resource causes the JSP to be executed.
> Typically,
> this approach is used to render XML content using a JSP view.
>
> When XML content types are defined in a module, it's common to have the
> template-elements property set automatically on new instances of the
> content
> type. Here's an example taken from my opencms-modules.xml:
>
> <resourcetypes>
> <type
> class="org.opencms.file.types.CmsResourceTypeXmlContent" name="article"
> id="80">
> <properties>
> <property>
> <!-- Determines
> behaviour of editor in outputting contents -->
>
> <name>content-conversion</name>
> <value
> type="shared">
>
> <![CDATA[cleanup;xhtml]]>
> </value>
> </property>
> <property>
> <!-- This
> property is set to define the JSP used to render the resource. -->
>
> <name>template-elements</name>
> <value
> type="shared">
>
> <![CDATA[/system/modules/{{runtime.opencms.module.name}}/template-elemen
> ts/a
> rticle.jsp]]>
> </value>
> </property>
> </properties>
> <copy-resources />
> <param
> name="schema">/system/modules/{{runtime.opencms.module.name}}/schemas/ar
> ticl
> e.xsd</param>
> </type>
> <!- ........ ->
> </resourcetypes>
>
> Jon
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Chris Tiernan
> Sent: 06 September 2006 02:25
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] template-element property
>
> I'm a little confused by the template-element property. Can anyone
> provide a quick explanation of this property, how I can benefit from
> using
> it, and point me to a good example? Thanks in advanced.
>
> Best,
> Chris
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060908/626c336d/attachment.htm>
More information about the opencms-dev
mailing list