How to reverse sort array?

Author Message

Paal Are Solberg

Monday 29 December 2003 4:35:02 am

Consider a standard fetch sorted by $node.sort_array:

{let articleList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id, 'sort_by', $node.sort_array ) )}
{section name=articleLoop loop=$articleList}
{$articleLoop:item.name}
{/section}
{/let}

Qestion: how do I fetch by the reverse order of the $node.sort_array?

Similarly (alternatively) ,how can I loop in the reverse order?

Ben Pirt

Tuesday 06 January 2004 4:43:48 am

Haven't tried this, but I think this should do it....

{let articleList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id, 'sort_by', array($node.sort_array, false())))}
{section name=articleLoop loop=$articleList}
{$articleLoop:item.name}
{/section}
{/let}

Let me know if it does and if not i'll look into it a bit more.

Ben Pirt

Christof Bollenbeck

Monday 25 October 2004 7:29:32 am

Hi everybody,

I need this too and it doesn't work as expected.

When showing all children of a folder, they appear reverse to the sort order defined in that node. In the left menu, the same objects are displayed as they should.

Any idea?

Greetings, Christof

Christof Bollenbeck

Tuesday 26 October 2004 4:18:53 am

http://www.ez.no/community/bug_reports/inconsistency_between_template_and_fetchalias_ini

This information solved my problem...

Christof

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 03:41:11
Script start
Timing: Jan 31 2025 03:41:11
Module start 'layout'
Timing: Jan 31 2025 03:41:11
Module start 'content'
Timing: Jan 31 2025 03:41:12
Module end 'content'
Timing: Jan 31 2025 03:41:12
Script end

Main resources:

Total runtime0.0224 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.1328151.2109
Module start 'layout' 0.00550.0041 739.3438220.6875
Module start 'content' 0.00960.0116 960.0313997.6797
Module end 'content' 0.02120.0011 1,957.710933.9922
Script end 0.0224  1,991.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002511.0410140.0002
Check MTime0.00114.7407140.0001
Mysql Total
Database connection0.00083.400510.0008
Mysqli_queries0.003415.379030.0011
Looping result0.00000.075610.0000
Template Total0.00083.510.0008
Template load0.00062.792210.0006
Template processing0.00020.728710.0002
Override
Cache load0.00041.965510.0004
General
dbfile0.00114.928280.0001
String conversion0.00000.033040.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