Forums / Setup & design / How to sort a matrix at display ?

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

eZ debug

Timing: Jan 18 2025 20:48:07
Script start
Timing: Jan 18 2025 20:48:07
Module start 'content'
Timing: Jan 18 2025 20:48:08
Module end 'content'
Timing: Jan 18 2025 20:48:08
Script end

Main resources:

Total runtime0.7098 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 588.8672180.8359
Module start 'content' 0.00720.5745 769.7031599.0000
Module end 'content' 0.58170.1280 1,368.7031337.3984
Script end 0.7098  1,706.1016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.5929210.0002
Check MTime0.00150.2105210.0001
Mysql Total
Database connection0.00140.198810.0014
Mysqli_queries0.628588.54142020.0031
Looping result0.00190.26722000.0000
Template Total0.680395.820.3402
Template load0.00270.374020.0013
Template processing0.677795.468820.3388
Template load and register function0.00010.016910.0001
states
state_id_array0.00120.169010.0012
state_identifier_array0.00080.117620.0004
Override
Cache load0.00210.2996280.0001
Sytem overhead
Fetch class attribute can translate value0.00160.220940.0004
Fetch class attribute name0.00160.229970.0002
XML
Image XML parsing0.00130.188940.0003
class_abstraction
Instantiating content class attribute0.00000.002290.0000
General
dbfile0.00440.6178330.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs