Multiple Layouts

Topics: Writing themes
Dec 19, 2013 at 1:33 AM
Is it possible in the current version 1.7 to have multiple layouts.

Very few site I find have the same layout for every page.

I have seen the link http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx

explaining a way to do this but I'm surprised its not built in already.

Or is it? and if so how is it done.
Coordinator
Dec 19, 2013 at 2:35 AM
You can have layout alternates: http://docs.orchardproject.net/Documentation/Alternates, and there are several modules that let you choose the layout per item: http://gallery.orchardproject.net/List/Search?packageType=Modules&searchTerm=layout Finally, you can go for fully dynamic layouts with this module: https://bitbucket.org/onestop/module_onestop_layouts
Dec 19, 2013 at 7:17 PM
Im not quite sure what the first link is trying to show.

http://docs.orchardproject.net/Documentation/Alternates,

I suspect its the terminology that's confusing.

Lets say I have a 1 theme called MyTheme.

The theme has 2 Layouts.

MyTheme/Views/Layout.cshtml

MyTheme/Views/Layout-Contact.cshtml

I have Two Layers called Home and ContactUs

I want the Home layer to use the MyTheme/Views/Layout.cshtml

I want the ContactUs layer to use MyTheme/Views/Layout-Contact.cshtml

Option Number 3

https://bitbucket.org/onestop/module_onestop_layouts

Has no instructions or explanation as to what it is or does unless Im no seeing something.......

Billy
Coordinator
Jan 5, 2014 at 7:47 AM
You can't associate a layout to a layer, because more than one layer (or none) can be active on any given request. Activate shape tracing to see what alternates are available and which is the best for what you're trying to do.

Option number 3 now has full documentation.