This project is read-only.

Setting Up Page Specific Navigation In AsideFirst Zone

Topics: Customizing Orchard
Jan 9, 2013 at 9:06 PM
Edited Jan 9, 2013 at 9:07 PM

It's been quite a love affair with Orchard over here and I find myself promoting its use to all my friends.  Thanks so much for everyone's great efforts.

Unfortunately, I am now hitting a rather scary looking wall and was hoping for some advice from the pros.  I'm setting up a Page content type in order to allow me to manage pages like the one linked below:

The issue is with the left column.  Our site is complex enough that we require a sub-navigation to be displayed on the left column - apart from the main navigation.  This navigation varies from page to page and varies enough that using layers to show different content in that space seems crazy.  For the life of me I can't figure out how to insert page specific content like this outside of the "Content" zone.

Any advice, even the "read a book" variety, would be greatly appreciated.



Jan 9, 2013 at 10:08 PM
Edited Jan 9, 2013 at 10:08 PM

So how many different submenus are you talking about? Is it like one submenu per page? Or 1 submenu per 10 pages?

If it's the former, you could attach the NavigationPart to your Page so that you can assign a menu per page (you would probably have to implement your own NavigationPartDriver though, since the one out of the box does not implement the Display method, which you may need to generate a shape that you can render in the aside zone.

If it's the latter, you may want to create a custom layer rule that will for example activate on a custom condition, which would evaluate to true for all pages for which you want to show the sub menu.

With the first approach you will be able to select the desired submenu to render per page.

Jan 10, 2013 at 4:54 PM

Thanks so much for writing back.  It really comes down to the fact that when I add an HTML/Text field to the Page content type I'm unable to position it outside of the Content zone.  My file looks like this after creating an HTML field called Left Column SubNav.

<Match ContentType="Page">
<Place Fields_Common_Text-LeftColumnSubnav="AsideFirst"/>

And nothing displays.  If this is by design then any advice on how I can layout content fields and parts using div's, rather than stacking top-down would be appreciated.

Thanks again!


Jan 10, 2013 at 7:09 PM

I see. You need to use special syntax in when positioning shapes outside of the "local zone" (local zones basically are child shapes of the content shape, while "ordinary" zones like "AsideFirst" are child shapes of the Layout shape).

To place a shape in a "global" zone, use this syntax: "/AsideFirst".

Jan 10, 2013 at 7:55 PM

That does it!  Thanks a million.  Such an elegant solution.  The Orchard love affair continues.  Cheers, Toby

Mar 21, 2013 at 1:13 AM
I realize this post is a bit old, but I came across it while needing something similar. Basically what I am after is the ability to put a standalone menu on a page. What would be most preferable is if I can pick a menu that will be displayed in a zone I specify (like asidefirst). The flow would be something like this, create a page, while creating that page, pick a menu (that I already put together) and specify what zone to render it in. When that page is rendered, show the menu in the zone. I would be okay with using layers, except that I am using content types for these pages that need menus and these content types have custom fields on them and I don't see how to combine these concepts without having to create one layer per page. Any ideas are welcome. In the end, my requirement is a standalone menu that can be attached to a page and the menu will be different depending on what page is displayed. sfmskywalker mentioned above a navigationpartdriver to do this, but there is no documentation on this and I have no idea where to start. Even looking at other modules gave me no clue where to start...
Mar 29, 2013 at 8:30 PM
You could write a custom part that lets you select the menu to render in which zone. The interesting next part is how to actually render the selected menu in the selected zone. You could probably do this by implementing an IShapeTableProvider and setting Placement from there for the shape to be rendered by the driver that renders the widget. You could probably reuse the MenuWidgetPartDriver for that.

An even better idea might be to build something that allows you to assign widgets to any content item. It could be implemented as a WidgetsHostPart that enables the user to add widgets. I like this so much that I'll investigate the idea further.
Mar 31, 2013 at 12:22 AM
Just posted a new module here that may enable your scenario: