[opencms-dev] xmlcontent, skipping elements, and also disabling icon display
Marcus Popetz
marcus at roundpeg.com
Mon Jun 5 18:02:27 CEST 2006
Hi all,
I'm using the contentload tag to iterate and now I'm wanting to skip
certain elements in the iteration based on their properties. When I do
this, the edit/delete icons still appear for the skipped content and cause
a mismash of icons that looks really confusing.
Anyway to skip an item in contentload and to have that skip printing the
edit/delete icons?
Here's my code as it stands:
<%@ page import="java.util.Date"%>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<cms:editable/>
<cms:contentload collector="allInFolderPriorityDateDesc"
param="/news/news_${number}.html|AAU_News" editable="true">
<c:set var="strReleased"><cms:contentshow element="ReleaseDate" /></c:set>
<c:set var="strClosed"><cms:contentshow element="CloseDate" /></c:set>
<%
boolean active = false ;
try
{
Date releaseDate = new
Date(Long.parseLong((String)pageContext.findAttribute("strReleased")));
Date closeDate = new
Date(Long.parseLong((String)pageContext.findAttribute("strClosed")));
if(releaseDate.before(new Date()) && closeDate.after(new Date()))
{
active = true;
}
} catch (Exception e) {}
if(active)
{
%>
<div class="newswidget"><cms:contentshow element="Title" /></div>
<cms:contentshow element="Teaser" />
<a href="<cms:link><cms:contentshow
element="${opencms.filename}" /></cms:link>">read more...</a>
<br><br>
<%
}
%>
</cms:contentload>
<br />
More information about the opencms-dev
mailing list