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

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

eZ debug

Timing: Jan 31 2025 06:12:23
Script start
Timing: Jan 31 2025 06:12:23
Module start 'layout'
Timing: Jan 31 2025 06:12:23
Module start 'content'
Timing: Jan 31 2025 06:12:23
Module end 'content'
Timing: Jan 31 2025 06:12:23
Script end

Main resources:

Total runtime0.0150 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.0156151.1953
Module start 'layout' 0.00520.0022 739.210936.6172
Module start 'content' 0.00740.0060 775.828190.1250
Module end 'content' 0.01350.0015 865.953129.9922
Script end 0.0150  895.9453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002314.9839140.0002
Check MTime0.00106.9631140.0001
Mysql Total
Database connection0.00074.555910.0007
Mysqli_queries0.002415.830730.0008
Looping result0.00000.160210.0000
Template Total0.00117.510.0011
Template load0.00095.913310.0009
Template processing0.00021.582610.0002
Override
Cache load0.00064.024710.0006
General
dbfile0.002113.872380.0003
String conversion0.00000.044440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs