[opencms-dev] XML-Content selected by date

Jens Kreutschmann jens at nephila.de
Sat Aug 19 19:12:08 CEST 2006


Hello all,
I am trying to put a news archive on my site. I want the articles older than
a given date on an extra page.

I've been playing around a bit and came up with:


CmsJspXmlContentBean content = new CmsJspXmlContentBean(pageContext,
request, response);

CmsJspTagContentLoad contentlist =
(CmsJspTagContentLoad)content.contentload("allInFolderDateReleasedDesc","/de
/presse/blub_${number}|article",true);
Calendar ArchivZeit = Calendar.getInstance();
ArchivZeit.add(Calendar.HOUR,-32);
String locale = content.property("locale","search");

Calendar ArtikelZeit = Calendar.getInstance();

while(contentlist.hasMoreContent()){
  ArtikelZeit.setTimeInMillis(Long.parseLong(content.contentshow(contentlist
,"Release")));
  if(ArtikelZeit.after(ArchivZeit)){
      out.print("<div><h3>"+content.contentshow(contentlist,"Title")+"</h3>"
);
   out.print("<br
/>"+CmsDateUtil.getDateTime(ArtikelZeit.getTime(),DateFormat.SHORT,new
Locale(locale)));
    out.println("</div>");
  }else{
    break;
  }
}



This works nearly fine. It works in the online project. However, in the
offline project it shows me the wanted result plus an unwanted direct edit
button for the first article which is older than 32 hours(in this case)
I can imagine, why this is, but i dont know how i can work around this
problem.

Would be glad, if i can get any help or hints

Jens





More information about the opencms-dev mailing list