Share » Forums » Setup & design » Sort grandchildren

Sort grandchildren

Sort grandchildren

Tuesday 02 January 2007 11:46:54 pm - 2 replies

Modified on Tuesday 02 January 2007 11:48:14 pm by Softriva .com

Author Message

André R.

Wednesday 03 January 2007 3:35:34 am

$some_node.children is not sorted, and as you will see from the debug output the children is fetched when you call $some_node.children (the ezcontentobjecttreenode object have several dynamicly fetched methods).

So instead I suggest you do something like this:

{def $cMs=fetch(content,list, hash('parent_node_id', 59,'sort_by',array( 'priority', true() )))
      $subM=false()}
{foreach $cMs as $cM}
        {$cM.name|wash}
        {if $cM.is_container}
            {set $subM=fetch(content,list, hash('parent_node_id', $cM.node_id,'sort_by',array( 'priority', true() )))}
                {foreach $subM as $child}
                        <a href={$child.url_alias|ezurl()}>{$child.name|wash}</a>
                {/foreach}
        {/if}
{/foreach}

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Softriva .com

Thursday 04 January 2007 2:39:36 am

Thank you, worked perfect.

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

36 542 Users on board!

Forums menu