Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orchard CMS - theming

I have some questions regarding theming Orchard CMS. So, 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 and 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!

like image 759
wegelagerer Avatar asked Mar 31 '11 12:03

wegelagerer


3 Answers

  1. when you edit the page in the admin, the url will look something like http://localhost:30320/OrchardLocal/Admin/Contents/Edit/16

    16 is the id here.

  2. Several things you can do. Easiest is to use this module: http://orchardproject.net/gallery/List/Modules/Orchard.Module.Downplay.Orchard.LayoutSelector

    Alternatively, you could programmatically create alternates based on arbitrary criteria: http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx

    Finally, you can often avoid to have to create an actual separate layout by just varying what widgets go where, using layers.

  3. The body tag is in document.cshtml, which you can override in your own theme.

like image 87
Bertrand Le Roy Avatar answered Oct 18 '22 21:10

Bertrand Le Roy


1. Not sure what you mean by ID? If you click Widgets on the DashBoard, there are Layers there. A layer is a collection of widgets that will activate for a specific thing, Like the authenticated Layer will display those widgets you define when a user is authenticated.

Expanding on (1) and for (2), you will be able to create a new layout by adding widgets to a layer.

Check out:
Tagged Layer Rule - Allows you to add widgets based on a tag. Now, you can add pages for concepts and rentals and then specify a layer for these tags, within that layer, you can add any widgets you like. These will only appear when that tag is encountered.

Also check out:
Content Type Layer Rule - Haven't tried this, but it falls on the same lines.

3. To customize the look there is something called Shapes. Each Zone I think has a corresponding cshtml files. You can even use the ShaperBuilder to even render html in code, again, don't know too much about this but I can tell you, you need to look into these articles.

  • Using shapes as Html helpers in Orchard
  • Using shapes as Html helpers in Orchard
  • Taking over list rendering in Orchard
  • Dispatching Orchard shapes to arbitrary zones

HTH, I'll try and contact some orchard folk that are on SO.

like image 43
gideon Avatar answered Oct 18 '22 20:10

gideon


So to help you out here

  1. The ID of the Home Page is always 11 for a fresh install though I imagine that you can delete the home page and create a new one and give it another ID. To find the ID of the other pages open up the DB and look at the Content Items.

  2. I know of no way to apply Layouts other than by ID so just duplicate the layout pages as you have so few pages.

  3. I would just use a small jQuery script

    $(document).ready(function{ $('body').addClass('SomeClass'); });

like image 22
runxc1 Bret Ferrier Avatar answered Oct 18 '22 21:10

runxc1 Bret Ferrier