3

The menu class documentation - and the provided example - do not seem to show any way for me to build a navigation menu with more than 1 level of navigation.

What do I do if I want to build an 'app-style' menu - like 'File' or 'Edit' - which will include sub-menus? Is there a way to create this automagically with Agile Toolkit, or is this something that would have to be coded by hand with html templates, css files, etc.?

romaninsh
  • 10,606
  • 4
  • 50
  • 70

2 Answers2

3

there is no such component by default - however, View "plug'n'play" also works for Menu's

here is one example of real life 2-level submenu: http://www.gradpool.ie/gradmatcher/graduate/company.html?id=38

idea there is that menu is constructed, and drop downs which fall out are yet another menu objects inserted into menu items.


add-on for this purpose has been created, read here: http://www.ambienttech.lv/blog/2012-07-06/tree_view_in_agile_toolkit.html

jancha
  • 4,916
  • 1
  • 24
  • 39
  • Can you provide an example of the code, i tried to capture the id like $m=add('Menu_Basic',null,'Menu'); and then capture id of the added Item $sm=$m->addMenuItem('SubMenu',null); and then add an item to the submenu with $sm->addMenuItem('Item','pagename'); but it doesnt seem to work out of the box. – Trevor North Jul 06 '12 at 15:11
  • Okay, I checked code - sorry, that is no more valid for 4.2 - the approach above which I suggested would be possible using Menu/Compat.php. let me think of valid alternative. – jancha Jul 06 '12 at 16:49
  • I abandoned trying to extend Menu_Basic or Menu_Light and went for the view approach which is working ok in 4.1.3. Thanks – Trevor North Jul 07 '12 at 16:30
1

I would suggest to use your own CSS along with Menu_Light, which is designed to get out of your way as much as possible.

https://github.com/romaninsh/atk4-sitesample/blob/day1/templates/Symisun_01/shared.html https://github.com/romaninsh/atk4-sitesample/blob/day1/lib/Application.php

The only thing it does is adding a class to your menu template, the rest you control over the HTML.

As a result you'll get something like this: http://example.agiletoolkit.org/examples/website/index.symisun

Be sure to use page tag around page names account/register.

romaninsh
  • 10,606
  • 4
  • 50
  • 70
  • The result page is not a valid link anymore - can you provide an example of the code as i've spent a couple of days playing with Menu_Basic and Menu_Light but cant get a working submenu. I can see in the shared.html, you've hardcoded the menus but i wanted to set this in Frontend.php as the menu will depend on the logged in users role. Even better would be if you can modify MenuBasic to allow submenus as i would guess this would be a pretty common requirement for anyone building a website using ATK4. – Trevor North Jul 06 '12 at 15:12
  • Follow this thread: https://groups.google.com/forum/?fromgroups#!topic/agile-toolkit-devel/kLD3l16D4tg – romaninsh Jul 09 '12 at 01:13