how to sort $node->menutext?

General project discussion. NOT for help questions.
Post Reply
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

how to sort $node->menutext?

Post 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
Last edited by blackhawk on Fri Mar 06, 2009 5:15 pm, edited 1 time in total.
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: how to sort $node->menutext?

Post 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!
Last edited by blackhawk on Fri Mar 06, 2009 5:18 pm, edited 1 time in total.
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: how to sort $node->menutext?

Post 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!
Last edited by blackhawk on Fri Mar 06, 2009 5:48 pm, edited 1 time in total.
cyberman

Re: how to sort $node->menutext?

Post 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}
Post Reply

Return to “General Discussion”