[opencms-dev] layout xmlcontent

Marc Fonteijn marc.mailinglist at unplug-it.nl
Fri May 12 11:50:05 CEST 2006


Hi,

I'm trying to layout my custom xml content using my own template.

The problem that I'm having is that the elements of the xml content are  
not found by the <cms:template> tag. In ordinary documents the control  
code contains the <element name="somename"> tag that is used to identify  
the element, but in my custom xml content I don't have the element tag...

How can I show the content of my xml content in the "columnright" of my  
main template?

My main template (/system/modules/my.module/templates/main) contains the  
following code:
===================================
<cms:template element="columnright">
   <cms:template ifexists="columnright">
     <div id="columnRight">
       <cms:include element="columnright" editable="true" />
     </div>
   </cms:template>
</cms:template>
===================================

My page (/system/modules/my.module/pages/simpleexample.html) for the  
structured document contains this:
===================================
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<cms:include property="template" element="header"/>

<cms:contentload collector="singleFile" param="${opencms.uri}"  
editable="true">

<div class="element">

   <h1><cms:contentshow element="Title" /></h1>

   <cms:contentloop element="Teaser">
     <p><i><cms:contentshow /></i></p>
   </cms:contentloop>

   <p><cms:contentshow element="Text" /></p>

</div>
</cms:contentload>

<cms:include property="template" element="footer"/>
===================================

And my structured content looks like this:
* property template is set to: /system/modules/my.module/templates/main
* property template elements is set to:  
/system/modules/my.module/pages/simpleexample.html
===================================
<?xml version="1.0" encoding="UTF-8"?>

<SimpleArticles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:noNamespaceSchemaLocation="opencms://system/modules/my.module/schemas/simpleexample.xsd">
   <SimpleArticle language="en">
     <Title><![CDATA[My Content]]></Title>
     <Teaser><![CDATA[My content teaser ...]]></Teaser>
     <Teaser><![CDATA[More teasers]]></Teaser>
     <Teaser><![CDATA[And one more]]></Teaser>
     <Text name="text0">
       <links/>
       <content><![CDATA[some content]]></content>
     </Text>
   </SimpleArticle>
</SimpleArticles>
===================================

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the opencms-dev mailing list