Projections on menu

Topics: Customizing Orchard, General
Jun 5, 2013 at 9:42 PM
Hi

I have a menu bar with several links on it. Three links are projections which will remain the same on each page but one of them is a projection which I would like to change depending on the page URL. I am really unsure how to do this. At first I thought I would create a whole different menu bar per page but I want to re-use some of the projections and it will only allow me to add the projection on to one menu.

My questions are:-
  1. Can I add the same projection onto different menus?
  2. Is it possible to match on page URL and display a particular projection?
Any help much appreciated!

Tx Kirsty
Jun 6, 2013 at 2:39 PM
Try using the 'Navigation' section in the admin back-end. It tends to be where I do all my menu changes / ordering now.

Question 1: You can select or create the different menus (in navigation) as well as add existing content items or just urls to the content onto any menu
Question 2: Ive not needed any route constraints for particular menu items so I'm not sure. You can certainly add a rule for the widget layer but that is probably a bit broad for what you are after and would create lots of very similar menus.
Jun 10, 2013 at 11:10 AM
Thanks Matt for your reply, very helpful.

I managed to achieve what I wanted by adding 2 different menus to appear next to each other in the end and by adding layer rules.

Kirsty
Jun 10, 2013 at 11:37 AM
Edited Jun 10, 2013 at 11:38 AM
Hi Kirsty,
I spent the weekend looking at this problem and think I have come up with a solution that has worked out in testing so far - one menu, different rules per menu item (if the navigation rule part is attached to the menu item type).

I have created a layer like part for menu items. So that you can put layer rules in, and they evaluate for routes correctly and I imagine that it would work for other layer rules (widget layers).

Module:
Orchard Gallery
How to use:
Blog post - I haven't really finished writing this yet.

I've created it with the 1.x branch (so may need some adjusting for 1.6) but i think I have commented out parts to make it compatible with 1.6 unless navigation has changed more drastically than first thought.

If you are able to test that out that would be great.
You can either create new menu item types with the part or add it to existing menu item types - but I've only really tested it with custom menu item.

Thanks,
Matt
Jun 18, 2013 at 4:17 PM

Thanks Matt,

Will look into this when I get chance.

Kirsty