Share » Forums » Setup & design » How to sort arrays of ez content...

How to sort arrays of ez content objects?

How to sort arrays of ez content objects?

Tuesday 16 September 2008 8:02:54 am - 4 replies

Author Message

Paul Etienney

Wednesday 17 September 2008 4:16:17 am

I have the same question.
+1

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Andreas Adelsberger

Wednesday 17 September 2008 4:29:18 am

You can create a new hash array and sort it afterwards using an extension:

http://ez.no/developer/contribs/template_plugins/arraysortoperator

...untested...

{def $new_array = array()} 
{foreach $children as $child}
		{set $new_array=$new_array|append(hash('name',$child.name,'ezobject',$child))}
{/foreach}

{set $new_array=$new_array|sort}

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Daniele Nocentini

Wednesday 17 September 2008 7:44:15 am

Thanks Andreas for your solution it's great and work fine for my project, only one thing I have declared variable as an array:

{def $new_array = array()}

Antica Bottega Digitale srl
http://www.abd.it

Andreas Adelsberger

Wednesday 17 September 2008 7:46:46 am

You are welcome. I fixed it in the code above.

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu