Advertisement
Xliff

Smarty Menus

Dec 11th, 2013
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Smarty 0.49 KB | None | 0 0
  1. Menu arranged as such
  2.  
  3. $menus = array(
  4.     'menu-id-1': (item1, item2, item3, item4....),
  5.     'menu-id-2': (.....)
  6. );
  7.  
  8. Each menu item has a submenu ID that can be matched to the $menus array.
  9.  
  10. Will this template generate the right menu hierarchy?
  11.  
  12. {* Must use global menus variable to determine hierarchy. *}
  13. {function name=menu}
  14.     <ul>
  15.     {foreach $data as $m}
  16.         <li>
  17.             {$m}
  18.             {if is_array($menus[$m@key])}  
  19.                 {menu data=$menus[$m@key]}
  20.             {/if}
  21.         </li>
  22.     {/foreach}
  23.     </ul>
  24. {/function}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement