Monday 13 January 2003 11:28:34 pm
Having a need to sort the contents of a fetch I did some digging and have found some information in regards to the "sort_by" parameter of the fetch(content,tree,hash(parameters)) template function (and probally fetch(content,list,hash(parameters)) as well) sort_by takes (multiple groups - I haven't tried this but the code looks like it will) of 2 parameters
sort field - the field to sort by. Valid options are
'path'
'published'
'modified'
'section'
'depth'
'class_identifier'
'class_name' 'priority'
sort_order
true = ascending false = desending
So
fetch(content,tree,hash(parent_node_id,29,sort_by,array(published,true)) Will return all nodes under node 29 ordered from the first published to the last published. If you do not have 2 parameters the sort will default to "path ascending" I have also patched the system (3 additional lines) to enable to sort by object name. (See http://developer.ez.no/bug/bugview/1773/ )
Hope this helps someone.
Cheers Bruce
My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish
|