Forums / Setup & design / How to reverse sort array?

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