Forums / Developer / Sorting an array in a template

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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/