[opencms-dev] Ordering by a custom date field

Jose Ignacio Yarza jiyarza at opensistemas.com
Fri Jan 20 14:04:42 CET 2012


Thank you Antonio and Patric for your replies. We will try that and let
you know the results.


Cheers.

On Fri, 2012-01-20 at 11:51 +0100, Antonio Cordeddu wrote:
> Hi Jose,
> 
> you can use a mapping in your xsd schema:
> 
> <xsd:appinfo>
> <mappings>
> <mapping element="MyDate" mapto="property:collector.date" />
> </mappings>
>          ...
> 
> </xsd:appinfo>
> 
> When the content editor saves the content the value of MyDate is written 
> on collector.date property.
> Then you can use the collector
> 
> collector="allInSubTreePriorityDateDesc", like Khởi suggested you.
> 
> Let me know if this work for you.
> 
> 
> Best regards
> Antonio Cordeddu
> 
> 
> _______________________________________
> Coranto informatica di Antonio Cordeddu
> Via Torricelli, 9 09047 Selargius (CA)
> antoniocordeddu at coranto.it
> Skype: antonio.cordeddu
> http://www.coranto.it
> ___________________________________________
> 
> 
> 
> 
> On 20/01/2012 11.32, Jose Ignacio Yarza wrote:
> > Hi Khởi,
> >
> >
> > Thank you for your reply.
> >
> > The sentence I wrote loads all the files whose name matches the pattern
> > "content_%(number).html" inside the directory "/internet/news/notes/".
> >
> > ie:
> >
> > content_123123123132.html
> > content_128379173987.html
> > ...
> >
> > A custom module appends a timestamp to each new content file of this
> > type.
> >
> >
> > What we want to do is loading the full directory but we need to use a
> > custom date field for ordering (MyDate) instead of the collector.date or
> > the automatic publish date.
> >
> >
> > Thanks!
> >
> >
> >
> > On Fri, 2012-01-20 at 17:22 +0700, Khởi Nguyễn Văn wrote:
> >> hi Jose,
> >>
> >>
> >> I don't understand %(number) of you which it means what?
> >>
> >>
> >> - do you want to load a file which its "Structured Content
> >> = MyContentType"&  "file's name=content_1.html"&  "on
> >> folder /internet/news/notes/" ?
> >> if it's right, you use code:
> >> <cms:contentload collector="singleFile"
> >> param="/internet/news/notes/content_%(number).html" editable="true">
> >>
> >>
> >> - if you want to load some of files which our "Structured Content
> >> = MyContentType"&  "on folder /internet/news/notes/"
> >>
> >>
> >> <cms:contentload collector="allInSubTreePriorityDateDesc"
> >> param="/internet/news/notes/|MyContentType|15" editable="true">
> >>
> >>
> >>
> >>
> >> good luck!
> >>
> >> 2012/1/20 Jose Ignacio Yarza<jiyarza at opensistemas.com>
> >>          Hello List,
> >>
> >>
> >>          This is my first post so greetings to everyone, and please
> >>          bear with me.
> >>
> >>          I have a custom schema with this date field defined in it:
> >>
> >>          <xsd:element name="MyDate" type="OpenCmsDateTime" minOccurs="1" maxOccurs="1" />
> >>
> >>
> >>          I need to show listings ordered by this custom field. With some researh I found a collector and tried this in the JSPs:
> >>
> >>          <cms:contentload
> >>          		collector="allInFolderDateDesc"
> >>          		param="/internet/news/notes/content_%(number).html|MyContentType|15|MyDate"
> >>          		pageSize="${param.pageSize}"
> >>          		pageIndex="1"
> >>          		editable="false">
> >>
> >>
> >>          But it does not work as I expected the list ordering is
> >>          somewhat arbitrary. I have not found much documentation about
> >>          this collector in particular so maybe something is wrong
> >>          there.
> >>
> >>          Any help is very appreciated. This is a production system in a
> >>          public administration, and this change is important for my
> >>          customer since currently it shows the news disorderly.
> >>
> >>
> >>          Version is OpenCMS 7.
> >>
> >>
> >>          Thank you,
> >>
> >>          Jose
> >>
> >>          _______________________________________________
> >>          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/cgi-bin/mailman/listinfo/opencms-dev
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> -- 
> >> Best Regards,
> >> ------------------------
> >> Nguyen Van Khoi
> >> Sutrix Media - Developer
> >>
> >> Mobile: 0976.593.588
> >> Skype: vankhoiqn2003
> >> Yahoo: vankhoiqn2003
> >>
> >>
> >>
> >> _______________________________________________
> >> 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/cgi-bin/mailman/listinfo/opencms-dev
> >>
> >>
> >>
> 
> 
> 
> _______________________________________________
> 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/cgi-bin/mailman/listinfo/opencms-dev
> 
> 
> 

-- 
Open Sistemas
Jose Ignacio Yarza Vidal
Telf: 649 157 537






More information about the opencms-dev mailing list