[Zope-CMF] Howto sort entries

Tres Seaver tseaver@zope.com
Mon, 11 Mar 2002 10:50:28 -0500 (EST)


On Mon, 11 Mar 2002, Jens Hauser wrote:

> Hi,
>
> I can't get the following to work:
>
> ###CUT
> <dtml-in expr="objectValues( [ 'Document', 'Folder', 'Portal Folder' ] )"
>       sort=id,desc skip_unauthorized>
> ###CUT
>
> I thought this should list all documents, folders, ... by id, descending.
> Sadly It lists the entries by id, ASCENDING.
>
> Please forgive me - the solution sure is very easy ...

Checking the docs:

  <http://cvs.zope.org/Packages/DocumentTemplate/DT_In.py?rev=1.57&content-type=text/vnd.viewcvs-markup>

shows the following:

  Attributes

      sort -- Define the sort order for sequence items.  Parameter to the
      attribute is either a sort option, or list of sort options separated
      by comma.  Every sort option consists of variable name, optional
      comparison function name (default is cmp) and optional sort order
      (default is asc).
          Examples: sort="date" or sort="date,time" or
      sort="title/locale,date/cmp/desc". If you want to specify sort order,
      you cannot omit the function; use cmp for standard comparison.


-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com