Forums / Developer / Sorting an array

Sorting an array

Author Message

Randeep Walia

Wednesday 08 September 2004 3:39:33 pm

Of course you can sort an array list returned by the fetch function, but what about an array that already exists?

In this case I want to sort the related_content_object_array that is part of my article class. This array contains the article_page objects that I use to create multi-page articles. I want to sort it by page number to guarantee that when I access this array it churns out its pages in the proper order. Is this possible?

__________________________________
Randeep Walia is http://www.rundeep.net powered by EZ Publish

Ole Morten Halvorsen

Thursday 09 September 2004 2:02:30 am

No, eZ publish doesnt have any sort operator, so if you need this Im afraid you will have to create the operator yourself.

Creating a mapping between a php function and a template operator is very simple.
Have a look at the <b>[PHP]</b> section in settings/template.ini.

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578