scalaviewlift

How should I create customized menu with Lift framework?


I need to have the following structure

- Home
- Categories for posts
  - Category1
  - Category2
    - Subcategory1
    - Subcategory2
    - Subcategory3
  - Category3
    - Subcategory4
    - Subcategory5
- Some static pages
  - Page1
  - Page2
- Another post type # this is completely different model than for posts
  - Subcategory1
  - Subcategory2

I don't want to display all of those categories in the menu. From what I've looked at the SiteMap class, it looks like I should define everything in there, and then use the menu builder to render the menu.

The problem is that if I define the whole menu with static markup, I won't be able to render the menu based on which page I currently am. But defining the whole structure via SiteMap doesn't seem like a viable option, since categories are dynamic and I only need some of them to be displayed in specific places.


Solution

  • SiteMap is your friend.

    You can group menu items such as:

    Menu.i("About") / "about" >> Hidden >> LocGroup("bottom")
    

    and display only this group in your template:

    <span class="lift:Menu.group?group=bottom"></span>

    Taken from: http://simply.liftweb.net/Simply_Lift.pdf

    If you would want dynamic menu items - try seaching

    http://groups.google.com/group/liftweb

    with the keyword "supplimentalKidMenuItems"