[opencms-dev] Contentload problem?

Jonathan Woods jonathan.woods at scintillance.com
Wed May 10 11:37:59 CEST 2006


Toni -

Sounds like a good solution.  Interesting to note that the <cms:contentinfo>
isn't documented at all, as far as I can tell.

>From digging around in source code, I think the case of the contentinfo var
attribute value may need to be "CollectorInfo".

Jon

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Toni PĂ©rez
Sent: 10 May 2006 09:58
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Contentload problem?

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
>

_______________________________________________
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