[opencms-dev] Contentload problem?

Toni PĂ©rez tp.ocms at gmail.com
Wed May 10 10:57:56 CEST 2006


Hi, Gunther.

You could try this:

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core" %>

<% int jobCount = 0; %>

<cms:contentload collector="allInFolderDateReleasedDesc"
param="/jobs/job_${number}.html|123" editable="true">

	<cms:contentinfo var="collectorInfo" scope="page" />
	
	<c:if test="${! pageScope.collectorInfo.emptyResult}">
		<% jobCount++; %>
	</c:if>
	
</cms:contentload>

<%= jobCount %>


The code was written on-the-fly so it could not compile.

I hope that helps.

PS.: this question is a frequently asked question on the list. I think
it would be a good idea to include a couple of lines in the
documentation of the "contentload" tag.



On 10/05/06, DI Gunther Schmidl <schmidl at webdynamite.com> wrote:
> Hello list,
>
> I think there's a problem with the contentload collector. Consider the
> following code:
>
>         <% int jobCount = 0; %>
>
>         <cms:contentload collector="allInFolderDateReleasedDesc"
>                 param="/jobs/job_${number}.html|123" editable="true">
>
>                 <% jobCount++; %>
>
>         </cms:contentload>
>
>         <%= jobCount %>
>
> This will result in '1' being printed even if there is not a single file of
> type 123 in the directory (or indeed any file at all) -- the contentload
> runs erroneously. This means, in turn, that adding a contentcheck inside the
> contentload will result in a NullPointerException when there is no file, or
> no matching file, in the folder:
>
>         <cms:contentload collector="allInFolderDateReleasedDesc"
>                 param="/jobs/job_${number}.html|123" editable="true">
>
>                 <cms:contentcheck ifexists="WorkHours">
>                         Hi
>                 </cms:contentcheck>
>
>         </cms:contentload>
>
> I don't remember this problem from 6.0.x, so I'm wondering whether this is a
> newly-introduced bug, or different functionality -- in any case, it prevents
> my application from working correctly.
>
> Any help with this issue is highly welcome.
>
> Thanks,
>
> -- Gunther
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list