New menu list per page category

Topics: Developer Forum, Localization Forum, Project Management Forum, User Forum
Apr 8, 2009 at 4:43 PM
Hi Guys

I would appreciate any input. I have 6 major categories and each one should have its own list of pages e.g.: I have a category called mortgage, then have 10 pages under that, but here is the trick I don't want the whole menu to display on every page only pages relevent to category see example below:

Mortgages
1. First time buyer
2. Fixed rage Mortgages
3. etc.

Loans
1.
2.
3.

I think you get the picture.

Thanks for your help in advance.
Apr 9, 2009 at 12:53 PM
Edited Apr 9, 2009 at 12:55 PM
Hello,

Sadly, I don't think it's a straight-forward job. 

My first guess would be to code the menu item click event up to detect which root menu item was selected, (either directly, or via a descendant menu item), then display that categories items, and/or hide all menu items not in that category.  It's easy enough to detect the selected root node, and programmatically changing styles on the menu can also be done, but I don't see a "configuration-only" way to achieve what you're after.

Possible alternatives include:
  • Set the menu control, (in the *.skin file) to display only one level, (e.g.  Menu.StaticDisplayLevels=1, Menu.MaximumDynamicDisplayLevels=0), then add a SubPages Section to each category page.  (This works for selecting child pages from category pages, but once on the child page, there's no way to display the other child pages in that category with this mechanism - of course, you could have a link that goes back to the category page).
  • Using the Menu.LevelSelectedStyles and Menu.LevelSubMenuStyles to hide/display items depending on state/level.  Again, I suspect this will break down once the user gets to a child page.

My guess is, you're going to need some custom coding to get his working, (or alternatively, a little flexibility on the requirements).  Maybe someone else has a better/already coded solution?

Please note: Changing the Menu control's configuration, (even slightly), usually leads to changes in the skin file styling being necessary.


HTH,

Jim.

Apr 9, 2009 at 5:13 PM
Well, an easy way to work around is use a different theme for each category, then maybe use a create a static MENU UserControl for each Category. That way you could have a different MENU in each Category THEME. Drawback is maybe the Menu wont be dynamically linked to the CMS Page Creation. You will need to manually add your Menu Items to the USER Control.

This isn't the ideal solution, but if you aren't changing the page structure often it would be sufficient.

Thank You,
TJ Havens
Apr 10, 2009 at 3:36 PM
Edited Apr 10, 2009 at 3:37 PM
Hey Guys

You both have excellent suggestions. I am going to give it a shot, seen i am no expert at C but let me try and see I might have to get back to you.

Thanks gain!

Cheers

Lance Spurgeon