How to sort a matrix at display ?

Author Message

Sébastien Antoniotti

Tuesday 12 December 2006 5:14:53 am

Hi,

I'm looking for a solution to sort a matrix on a column (alphabetical sort on the name by exemple), but I don't found anything in the documentation and forum...

Did someone has an idea ?

eZ Publish Freelance
web : http://www.webaxis.fr

Xavier Dutoit

Tuesday 12 December 2006 10:32:44 am

Salut,

Have a look at this extension, might be what you're looking for:

http://ez.no/community/contribs/template_plugins/sortable_ezmatrix_datatype

http://www.sydesy.com

Sébastien Antoniotti

Tuesday 12 December 2006 11:00:38 am

Salut,

Thanks for your help, I have seen this contrib, but it seems that she don't sort the php array, she display the ezmatrix in her default order, and then she add buttons to sort it with javascript.

I just want to display my matrix in a classic html table, but before looping into, I want to sort it on a column.

I hope someone will understand me... lol

eZ Publish Freelance
web : http://www.webaxis.fr

Claudia Kosny

Wednesday 13 December 2006 12:04:18 pm

Hi Sebastien

As far as I know there is no built in way to sort an ezmatrix. If you know PHP though it is fairly easy to write a template operator that takes an ezmatrix and a column name as input and returns a sorted 2 dimensional array - just grab the values of the matrix, put them into an 2 dimensional array and use e.g. usort() to sort by the specified column.

Good luck

Claudia

Sébastien Antoniotti

Wednesday 13 December 2006 12:51:08 pm

Hi Claudia,

Thanks a lot for your input, I think I'll try like this !

thanks again =)

eZ Publish Freelance
web : http://www.webaxis.fr

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 18 2025 23:09:34
Script start
Timing: Jan 18 2025 23:09:34
Module start 'layout'
Timing: Jan 18 2025 23:09:34
Module start 'content'
Timing: Jan 18 2025 23:09:35
Module end 'content'
Timing: Jan 18 2025 23:09:35
Script end

Main resources:

Total runtime1.5373 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0101 587.9141152.6250
Module start 'layout' 0.01010.0058 740.539139.4609
Module start 'content' 0.01591.5201 780.0000593.9219
Module end 'content' 1.53600.0013 1,373.921912.1563
Script end 1.5373  1,386.0781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2282160.0002
Check MTime0.00150.0970160.0001
Mysql Total
Database connection0.00190.122610.0019
Mysqli_queries1.472295.7662650.0226
Looping result0.00060.0422630.0000
Template Total1.459895.020.7299
Template load0.00260.170620.0013
Template processing1.457194.783420.7286
Template load and register function0.00010.005910.0001
states
state_id_array0.00370.240910.0037
state_identifier_array0.00360.235320.0018
Override
Cache load0.00210.1388280.0001
Sytem overhead
Fetch class attribute can translate value0.00050.033630.0002
Fetch class attribute name0.00090.056070.0001
XML
Image XML parsing0.00100.062630.0003
class_abstraction
Instantiating content class attribute0.00000.001290.0000
General
dbfile0.00230.1527220.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs