I need to sort an array with smarty. I try to use this code :
My foreach:
{foreach $hooks->addblock as $addblock}
<ul>
{foreach $addblock|@sortby:"prio" as $value}
{$value@key}: {$value}
{/foreach}
</ul>
{/foreach}
The var_dump of $hooks->addblock:
array(5) {
["filed_1"]=>
array(5) {
["id"]=>
string(7) "filed_1"
["title"]=>
string(6) "filed1"
["field"]=>
string(20) "This is test filed 1"
["size"]=>
int(740)
["prio"]=>
int(7)
}
["filed_2"]=>
array(5) {
["id"]=>
string(7) "filed_2"
["title"]=>
string(6) "filed2"
["field"]=>
string(20) "This is test filed 2"
["size"]=>
int(740)
["prio"]=>
int(6)
}
So, I want to sort array by value prio (num) ascending, but it does not come out properly!
Here the result:

I would like the line "field_2" be first. But I not find a solution.
This is the modifier (modifier.sortby.php): http://www.smarty.net/forums/viewtopic.php?p=23628#23628 I also have a recurring error:
[Sat Nov 24 20:04:52 2012] [error] [client 127.0.0.1] PHP Notice: Uninitialized string offset: 0 in /var/www/libs/plugins/modifier.sortby.php(33) : runtime-created function on line 1