This project is read-only.

Adding current layers as classes on layout-wrapper div

Topics: Customizing Orchard
Sep 19, 2011 at 12:29 PM

Would it be possible to add the current active list of layers as classes to the layout wrapper div in the Layout.cshtml file?  I can't seem to figure out how to get the current active list of layers for the page?

I want to achieve this so I can use different styles depending on the layer, i.e. I can style the home page zones differently.


Sep 22, 2011 at 3:43 PM

I don't know the answer to your question, however I also dont see the point of this ?

Layers only show what you added to them and they are only effective on the pages you add them to via layer rules. Isn't that what you want to achieve here ?

You can also use URL Alternates from Designer tools, and override the rendering of widgets in certain zones or on certain Urls aswell. 

Sep 22, 2011 at 4:09 PM

I see what you are saying and I have used that functionality elsewhere, however this case would cover when you have the same html widget that is used on all pages, but you would like to style it differently on the home page or using some other layer rule. If its just CSS styling, not html layout, it seems overkill to have to create an alternative template just to add a container class so I can style via my css.  If the top layout wrapper div just had the layer name added to its class list you could style using this.  Or maybe I am missing something?!

Sep 22, 2011 at 7:45 PM

I'm not sure about solving it that exact way (I'd have to take a dive into the code for that), but you may be interested in checking out the Classy feature of the Vandelay Industries module. I give an explanation of what it does here: