[opencms-dev] XML-Content selected by date

Dave Schoorl maillists at cyber-d.com
Mon Aug 21 17:26:20 CEST 2006


You could implement your own collector that will do the selection, so 
only valid documents are returned to CmsJspTagContentLoad. The main 
disadvantage is that you must register your collector in the config file 
opencms-vfs.xml. And this does not get distributed via the module mechanism.

/Dave

Jens Kreutschmann wrote:
> 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
> 
> 
> 
> _______________________________________________
> 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