Sorting an array in a template

Author Message

Patrick ALLAERT

Wednesday 17 August 2005 5:40:33 am

The only way I found how to sort an array in a template was:

{set arrayToSort = $arrayToSort|sort}

With the following in my template.ini:

PHPOperatorList[sort]=my_sort

And the following function somewhere in the code (index.php ?):

function my_sort( $array ) {
    sort( $array );
    return $array;
}

Enjoy :)

Patrick ALLAERT
http://www.dixite.com/
http://users.pandora.be/patrick_allaert/

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