Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
2.01
-
None
-
2.02 branch, java 1.4.2_06, any browser
Description
It looks to me like the ifEmpty tag is not working properly in all situations.
I have an already existing page to which I added the following tags:
<cms:contentNodeIterator contentNodeCollectionName="centralLeftLinks">
<cms:adminOnly>
<div style="clear:both;">
<cms:editBar editLabel="Edit" moveLabel="" deleteLabel="Delete"/>
</div>
</cms:adminOnly>
<td class="aktuell_links"><cms:includeTemplate /></td>
</cms:contentNodeIterator>
<cms:ifEmpty contentNodeCollectionName="centralLeftLinks">
<cms:adminOnly><td>
<div style="clear:both;">
<cms:newBar contentNodeCollectionName="centralLeftLinks" paragraph="linksParagraph" newLabel="New links" />
</div>
</td></cms:adminOnly>
</cms:ifEmpty>
The intention of this is to only offer a newBar if no "linksParagraph" has already been instantiated. Using this version with the cms:ifEmpty tag works fine for a newly created page.
If I have an existing page however, which didn't contain any "centralLeftLinks" contentNode so far, the newBar never shows up. If I somehow manage to make the page contain the contentNode for at least once (i.e. with the code snippet below), the ifEmpty tag then works the way it's supposed to work.
If I replace the above cms:ifEmpty tag with the following inline java code, however, I get what I need:
<%
ContentNode collection = null;
Content actPage = Resource.getActivePage(request);
try
catch (Exception e)
{ // Do nothing, if not found. } if ((collection == null) ||
((collection != null) && (!collection.isHasChildren()))) {
%>
I've deleted the "work" directory of tomcat, and I've also tried to patch the ifEmpty code to work exactly like my inline code, but that doesn't help.