[opencms-dev] Question about XML-Content- Concept
Wolfgang Winzer
wwinzer at ka-dus.de
Thu Jun 9 14:30:50 CEST 2005
Hi Anatol,
you are lucky, I just had the same challenge a week ago, so I should be
able to help.
You should read the documentation for xml-content first:
/sites/default/alkacon-documentation/documentation-xmlcontent/
Additionaly you should read the documentation for the taglib, focussing
on the last four tags (<cms:contentwhatever>):
/sites/default/alkacon-documentation/documentation_taglib/
Equipped with this knowledge, I was able to create a simple jsp very
similar to this in the templateone. Here is the snippet I used:
### the JSP
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<cms:contentload collector="allInFolder"
param="/sites/kuaweb/news/newsitem_${number}.xml|7|3" editable="true">
<table>
<tr>
<td valign="top" style="border:0px solid green"><img
src="<cms:link>../images/pixelsoup/undlogonav.gif</cms:link>"></td>
<td valign="top" style="border:0px solid black; width:180px">
<div class="title"><cms:contentshow element="Title" /></div>
<cms:contentloop element="Teaser">
<div class="teaser"><cms:contentshow /><span
class="more">...mehr</span></div>
</cms:contentloop>
</td>
</tr>
</table>
</cms:contentload>
Forget about the html, the important parts are the <cms:contentXXX>-tags.
The <cms:contentload ...> is really a loop tag, for each newsitem found,
it will generate another <table>
It took me SOME time to figure out, what to put in the cms:contentloads
param attribute:
The first number (7=xmlcontent) specifies the filetype the contentloader
uses as filter. If you don't get any newsitems it might be that this
number doesn't match the filetype you gave your newsfiles. I looked up
that "7" in my opencms-vfs.xml where it says:
<type class="org.opencms.file.types.CmsResourceTypeXmlContent"
name="xmlcontent" id="7"/>
The second number is easy, just the maximum number of newsitems to
display. Can be even omitted.
You NEED to have a macrovalue like ${number} in the path, it is NOT
sufficient to specify a folder with newsitems in it.
### the newsfiles
These are my newsfiles
/sites/kuaweb/news/ newsitem_0001.xml
/sites/kuaweb/news/ newsitem_0002.xml
...
The leading zeros are important!
They need their property (can't remember the name and my connection is
down, look it up in the examples) set to the XSD defining their
structure. This also enables opencms to give you a GUI-Editor for your
newsitem.
Okay, gotta keep this short, because I gotta run.
Hope this gives you a start.
Wolfgang
Anatol wrote:
> Hi All,
>
> I made my first steps with xml-content files. Creating the XSD-file
> was described in the documentation. But what are the next steps? How
> can I define that a new Page should based on this XSD-files? And how
> can I add an entry in the New >> Structured Content List?
>
> Greetings
> Anatol
>
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
More information about the opencms-dev
mailing list