[opencms-dev] Template selection for XMLContent

Jonathan Woods jonathan.woods at scintillance.com
Tue Nov 14 18:21:09 CET 2006


Sorry; I didn't answer your question very directly.
 
The template used to render an XML content item is not selectable by the
user; it has to be set using the template-elements property, which should
contain the path of the JSP acting as the so-called template for the
resource.  It's this JSP which acts as the whole view and which therefore
generates navigation etc (typically by including other JSPs as well as
containing JSP code of its own).
 
Typically, though, you don't need to expect a workplace user to set the
property themselves.  For a custom XML content type, i.e. one you've
defined, then you can have the template-elements property set automatically
on creation of the resource.  This is the same thing as saying "the view for
XML content items of this type is generally _this_ JSP."  Here's a snippet
from opencms-modules.xml for one of my XML content types, 'article', which
uses this pattern:
 
   <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/mymodulename/template-elements/article.jsp]]>
       </value>
      </property>
     </properties>
     <copy-resources />
     <param
name="schema">/system/modules/mymodulename/schemas/article.xsd</param>
    </type>
...
 
Jon

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 15:47
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] Template selection for XMLContent



Yes that gets me the content from the XML content items, but how do I get
the template around the content area (all navigation menus etc.)? If you
create a normal content item you get the selection list where you can then
select e.g. TemplateOne, but XMLContent does not seem to have this selection
list.

 

Olli

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: 14 November 2006 15:39
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] Template selection for XMLContent

 

If on a particular resource you set the value of the property called
'template-elements' to the path of a JSP, then OpenCms will 'call' that JSP
when a user requests that resource.  Of course, the action of the JSP is
normally to include data from the XML content item, i.e. to act as its view,
but not necessarily so.

 

Jon

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 12:00
To: 'The OpenCms mailing list'
Subject: [opencms-dev] Template selection for XMLContent

Hi all,

 

I am trying to surround XMLContent with a template and noticed that when a
user creates a new XMLContent item there is no selection for template. Do I
need to exit the creation JSP in order to introduce this for XMLContent or
is there a different way in order to allow the users to select template for
their XML content?

 

Regards,

 

Olli 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20061114/2216982d/attachment.htm>


More information about the opencms-dev mailing list