This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Templates, fetch and sorting
expandshrink

Templates, fetch and sorting

Templates, fetch and sorting

Tuesday 14 January 2003 8:28:34 am

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

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from