Looking for the 'current zone' from inside a template

Topics: Customizing Orchard, Troubleshooting, Writing themes
Apr 29, 2013 at 12:01 PM
Hello,
Is there a way to know in which zone the current model is displaying, this expecially for a menu.cshtml alternate ?

Is it the Navigation, AsideFirst, AsideSecond zone ?
Depending on the zone I need to decide different rendering.

I find nothing in the Model, but as it is a shape, dynamic, tehre could be something the debugger doesn't display.

I could do search in the Layout, going through each zone and checking for the presence of the actual Model/item but not very efficient.

Thanks
Apr 29, 2013 at 12:10 PM
Edited Apr 29, 2013 at 12:12 PM
[ignore]Are you looking for @Model.Content.ZoneName ?[/ignore]

Ah no it doesn't work for me!
Coordinator
Apr 29, 2013 at 5:52 PM
Shapes normally don't know what parent shape they are in, no. What exactly are you trying to do?
Apr 29, 2013 at 6:52 PM
In my theme, I have a very special alternate of menu.cshtm due to bootstrap for the main navigation zone, but I also need widgets menus in AsideFirst or Second, I can do this with dedicated alternates named menu-alternatename.cshtml but each time I add a menu widget I have to write an alternate identical to the others....
Hope it's clear ?

PS: do you intend to move Nwazet Commerce to new media ? :)
Coordinator
Apr 29, 2013 at 7:10 PM
Sure, enable the widget alternates feature, and you'll be able to alternate per zone.

(not sure what needs to be moved in Nwazet Commerce as I don't remember it depending on Media in the first place)
Apr 29, 2013 at 7:29 PM
Thanks.
(The Image Field in product)
Coordinator
Apr 29, 2013 at 7:48 PM
(I don't anticipate it requiring changes, it should just pick up the new media selector when it's there)
Apr 29, 2013 at 7:49 PM
(Ok)