[opencms-dev] How to display external resources?

Christian Steinert christian_steinert at web.de
Sat Apr 1 13:21:10 CEST 2006


andrea cossu schrieb:
> Tnks for your answer,
> i tried to develop this process on my own but i didn't understand how 
> opencms match the template to the xml representing the resource.
> Do you know it? Can you explain me?
> thanks
>  
> andrea
>
>
Each resource in opencms has a special resource type. With each resource 
a resource loader is associated, but this mechanism is a bit complex and 
a bit buried in the system code.

But if you just want to control the template, that belongs to a 
resource, then you can set the "template" property. The value of this 
property must be the filename a JSP template that is stored somewhere in 
the opencms filesystem. The alkacon docs contain some documentation on 
how to write the code of a JSP template, but basically you can do almost 
any JSP stuff in there and you can access opencms resources and services 
by using the opencms taglib and the opencms scriptlet API, especially 
the class CmsJspActionElement.

It is possible to create your own XML-based content type and this is 
also described in the Alkacon docs, but I have not tried this yet. The 
idea is that you configure a new XML-content type in your module 
configuration (opencms-modules.xml). For this contenttype you specify an 
XML Schema which you store in the opencms filesystem.
This schema will be used to check your content for validity and opencms 
will also use the schema to automatically create an input form for 
editing you content.
There is an XML content demo that shows how to do it, but I have not 
really looked into this yet.


So if you want to store structured content in opencms, then you probably 
need to
- create your own structured xml-based content type
- create a template that can display these resources
- create some resources for your content type and use the "template" 
property to link these resources to your template

hope that helps a bit
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060401/6726fa9c/attachment.htm>


More information about the opencms-dev mailing list