[opencms-dev] <cms:contentload>-tag and no collector results

Marcus Popetz marcus at roundpeg.com
Mon Aug 21 17:29:48 CEST 2006


I believe they don't skip the body because you'll never see the "add new 
content' icon if you don't have at least one...it's a nastiness of the xml 
content stuff.

So, you have to create one manually which is a pain (check out the examples 
to find a xmlcontent you can use to create your new one).

http://lists.opencms.org/pipermail/opencms-dev/2006q2/024277.html
Here's something I did to help work around this problem.

-mp


At 10:53 AM 8/21/2006, Dave Schoorl wrote:
>Hi list,
>
>I am new to OpenCms and I am using version 6.2.2. I have a problem with 
>the cms:contentload-tag. When the collector finds no matching resources, I 
>receive a null-pointer exception. A snippet of my jsp is as follows:
>
><cms:contentload collector="myCollector"
>      param="${opencms.uri}|myResourceType" editable="true">
>
>   <cms:contentloop element="Paragraph">
>     <span class="par" title="Paragraph">
>       <cms:contentcheck ifexists="Title">
>         <h1><cms:contentshow element="Title" /></h1>
>       </cms:contentcheck>
>     </span>
>   </cms:contentloop>
>
>    ... looping through other elementtypes ...
>
></cms:contentload>
>
>When I look in the source code, I see at the end of the doStartTag in 
>CmsJspTagContentLoad the following (this is also the case in CVS HEAD):
>
>   // initialize the content load tag
>   init(container);
>   hasMoreContent();
>   return EVAL_BODY_INCLUDE;
>
>So, the body is included even when there is no content. Is it not better 
>to change this to:
>
>   // initialize the content load tag
>   init(container);
>   if (hasMoreContent() == true) {
>     return EVAL_BODY_INCLUDE;
>   } else {
>     return SKIP_BODY;
>   }
>
>I think this will be more appropriate. Or am I missing something?
>
>Kind regards,
>
>Dave
>
>
>_______________________________________________
>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