Is there a way to sort related_contentobject_array on node names?

Is there a way to sort related_contentobject_array on node names?

Wednesday 10 September 2003 9:29:40 am - 2 replies

Author Message

Gunnstein Lye

Thursday 11 September 2003 5:07:17 am

This is not supported directly. You have a few options:

1. Create a template operator that takes $Linkholder.object.related_contentobject_array as an argument and returns a sorted list.

or
2. Modify the relatedContentObjectArray() function in kernel/classes/ezcontentobject.php so that it sorts the result by name. ("ORDER BY ezcontentobject.name" at the end of the SQL query should do the trick, I think.)

or
3. Create a template operator that takes an object as an argument and returns a sorted list of related objects. It's about the same as #2, but cleaner.

Conor Murray

Thursday 11 September 2003 5:39:01 am

Thanks Gunnstein,

I went with the quick, dirty fix (suggestion 2), as I doubt I will ever want to display this data in anything other than alphabetical sequence. The modification you suggested worked perfectly :-)

I'm currently trying to stick to using the default template operators as much as possible, but I can see that for some sites it will be necessary to create new operators. When I find the time I will write a few template operators of my own, but that won't be tomorrow!

Thanks again for your very useful and accurate reply :-)

Language is a virus - William S Burroughs

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.