This project is read-only.

Couple of questions regarding theming

Topics: Writing themes
Mar 31, 2011 at 1:40 PM
Edited Mar 31, 2011 at 1:42 PM


I have some questions regarding theming Orchard CMS. I've already posted this to, but as the community might be larger here I've also posted it here.

Let's begin...

I have a website that will have 5 pages and some of them have different layouts.

Pages and zones within it:

Homepage - Content, TripelFirst, TripelSecond, TripelThird
Concept and Rentals page - Content, AsideFirst, AsideSecond
Press and Service Department page - Content, AsideFirst, AsideSecond (different layout then the previous two pages)

Note: Even though all of the pages have the Content zone, except Homepage none of the pages uses it. Other pages only have HTML widgets located in one of the zones.

1) I've read that it is possible to create the layout for the specific ID, the problem is I can't find that ID to create the layout for specific ID.

2) As you can see, couple of pages have the same layout, how to assign them to the specific layout? For example, if I create the layout for Concept and Rentals page how can I assign the specific layout to them also how can I assign the layout to Press and Service Department pages.

3) How to add the class tag to the body? The problem is that Orchard CMS creates the body before everything else so it isn't contained in the layout cshtml files.

Thank you in advance!

Mar 31, 2011 at 2:00 PM

1. How are you creating the pages, I assume you are creating Page content but leaving it empty? You can see the Id on the Url for the Edit button on any content.

2. My Layout Selector module is one way to acheive this, by adding a drop-down box to your Page content type that will let you choose between Layout overrides:

3. There might be easier ways to just add a class to body, but the Document.cshtml is what you need to override for full page customisation.

Mar 31, 2011 at 3:04 PM

First of all, thank you for the response!

1) Yes, I'm creating empty pages. Does it mean that if I have page content with ID 28 that widgets with IDs 29 and 30 won't be visible on that page (in case the layout is created for ID 28)?

2) Wow, that's exactly what I need.

3) If possible, could you point me to any explanation on how to use Document.cshtml because I can't find anything useful in official documentation?



Mar 31, 2011 at 3:13 PM

1) Widgets have their own IDs. They show or hide depending on what layer they are on. You can have layers that show or hide depending on a certain user role, layers that only show on certain pages, and you can even create your own custom Layer Rules. You can see all the Layers in the Widgets dashboard menu.

2) Cool!

3) If you place a Document.cshtml in your ~/Views folder, it will replace the default Document.cshtml from Orchard.Core.Shapes. So copy that original version from Orchard.Core/Shapes/Views into your own theme's views folders, and customise it however you want.


Apr 1, 2011 at 12:08 AM

FWIW, the SO question is also answered now.