[opencms-dev] Content Load

Nigel Kersten nigel at cofa.unsw.edu.au
Tue Jun 27 23:52:01 CEST 2006


On 28/06/2006, at 2:02 AM, Wils wrote:

> Hi everybody,
> I listing the XML content thus:
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
>
> <cms:contentload collector="allInFolderDateReleasedDesc" param="/ 
> test/medias/${number}|50" editable="true">
> <h3><cms:contentshow element="Title" /></h3>
> </cms:contentload>
> Then, i must get the URL of resources...Or i want list XML COntent  
> getting the element but in Schiplet code...
>
> How to write the Scriptlet code to:


I'm not sure if I'm understanding you, as your two code examples seem  
to be the same to me?

If you're asking how to get the filename of each of the XML content  
files as you loop through them, then you do this with:

<cms:contentshow element="${opencms.filename}" />

This only works at the "top" level of a contentload loop, so say if  
you're doing something like:

<cms:contentload collector="allInFolderDateReleasedDesc" param="/test/ 
medias/${number}|50" editable="true">
   <cms:contentshow element="Title" />
   <cms:contentcheck ifexists="LoopElement">
     <cms:contentloop element="LoopElement">
       <cms:contentshow element="${opencms.filename}" />
     </cms:contentloop>
   </cms:contentloop>
</cms:contentload>

then the inner "<cms:contentshow element="${opencms.filename}" />"  
won't work properly in my experience.

I tend to get around this with something like:

<cms:contentload collector="allInFolderDateReleasedDesc" param="/test/ 
medias/${number}|50" editable="true">
   <c:set var="XMLFilename">
     <cms:contentshow element="${opencms.filename}" />
   </c:set>
   <cms:contentshow element="Title" />
   <cms:contentcheck ifexists="LoopElement">
     <cms:contentloop element="LoopElement">
       <c:out value="${XMLFilename}" />
     </cms:contentloop>
   </cms:contentloop>
</cms:contentload>



Hope that is what you were actually asking. :)


-- 
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G






More information about the opencms-dev mailing list