Page 1 of 1

how to sort $node->menutext?

Posted: Fri Mar 06, 2009 4:47 pm
by blackhawk
Is there way to sort $node->menutext for the main menus? in code $node->menutext appears as childs (sub sections) of the main menu links. I would like to sort $node->menutext alphabetically, which i know will effect every drop down list.

Thanks!
bh

Re: how to sort $node->menutext?

Posted: Fri Mar 06, 2009 5:16 pm
by blackhawk
smarty's modifier.sort.php looks like it will work but how to we extract the keys from the node->menutext to load into a foreach loop? In other words what are we sorting by.

thanks!

Re: how to sort $node->menutext?

Posted: Fri Mar 06, 2009 5:29 pm
by blackhawk
ok so this is what i got so far my menu

Code: Select all


          {if $node->depth == '1'}<span>{$node->menutext}</span>
          {else}
                        
                        {foreach from=$node->menutext item=subnavitem}
                        {$subnavitem}
                        {/foreach}

                         {* I want to use this in my foreach statment but dont know the value to place after sortby |@sortby:??? *}                         

           {/if}
         
My apologizes, just learned that $node->menutext is an item of $nodelist.  Which still leads me to question how to sort $nodelist if it's depth is greater than 1.

Thanks!

Re: how to sort $node->menutext?

Posted: Fri Mar 06, 2009 8:45 pm
by cyberman
blackhawk wrote: smarty's modifier.sort.php looks like it will work 
Where do you find this modifier? It's not provided by default ...

But you can use some php command like a modifer

Code: Select all

                        {foreach from=$node->menutext|sort item=subnavitem}
                        {$subnavitem}
                        {/foreach}