[opencms-dev] Re: Why I failed in editing structured content? Cananyone give me a hand
Toni PĂ©rez
tp.ocms at gmail.com
Sun May 21 18:53:50 CEST 2006
Hi, Huang.
> [...] Now I have another problems. I want to extend this tutorial, that is I
> want to display multiple images. To that, I change the wdog_article.xsd
> from
> <xsd:element name="Image" type="OpenCmsVfsFile" minOccurs="0" />
> to
> <xsd:element name="Image" type="OpenCmsVfsFile" minOccurs="0"
> maxOccurs="5"/>
> and in file of article.jsp, I change
> <p><img src="<cms:link><cms:contentshow element="Image" /></cms:link>"
> ></p>
> to
> <cms:contentloop element="Image">
> <p><img src="<cms:link><cms:contentshow element="Image" /></cms:link>"
> ></p>
> </cms:contentloop>
> or
> <cms:contentcheck ifexists="Image">
> <cms:contentloop element="Image">
> <p><img src="<cms:link><cms:contentshow element="Image" /></cms:link>"
> ></p>
> </cms:contentloop>
> </cms:contentcheck>
> and in test dir, I add two images in the html file, but images do not
> appear.
>
> I also look through the news demo, found that in page of
> list_news_center.jsp, also using contentloop method, but they working not
> mine.
>
> I do not know what I neglect, so can you give me suggestions?
I think you have to write "<cms:contentshow />" instead of
"<cms:contentshow element="Image" />".
The element "Image" in the "news" structured content type is of type
"OpenCmsImage" which is a nested structured content type that has an
element also named "Image".
In your XSD you are defining an element "Image" of type
"OpenCmsVfsFile" which is a simple type so "<cms:contentshow />"
should be sufficient to iterate over the images of your content.
I hope that helps.
More information about the opencms-dev
mailing list