Dynamically Changing Themes

I'm fairly new to Orchard although have experience of other CMS systems (DotNetNuke, N2, etc.). I am currently working on a small site and need to dynamically change the theme depending upon what page they are on.

Can someone explain how this is achieved? I'm a little confused about the relationship between Layers, Themes & Zones.

I always recommend putting your custom code in a module. Technically you can put custom code in a theme (or theme override) but it is hard to keep organized that way. You can use the following link to have Orchard create an empty module:

Once you have your empty module, I would create a Services folder and implement IThemeSelector. If you want an example (or maybe it will work for you as is but I don't think so) there is a module called Vandelay Industries (Bertrand built it - thanks
Bertrand) here:

Thanks jao28! That really helped... I've created a new module and added a class that implements IThemeSelector as you suggested. This class simply forces the theme to be one called "blue". As follows....

Ah, it seems like you're confused about what a part and a theme selector are. A theme selector is not a content part, and you shouldn't add it to a content type. The theme selector will get executed just by virtue of the feature it's part of being enabled,
and the fact that it implements the interface. Nothing more needs to be done for the system to pick it up, and you don't need to worry about where it will get executed in the lifecycle.

For a theme selector to make sense, it needs to only act on a certain condition. Otherwise, it's always going to be active and if its priority is high it will trump everything else. Again, Vandelay's theme selector is a good piece of code to look at to understand
this.

Thanks! Just out of interest (and to get more of a handle how this works...) what would happen if the Vandeley theme selector is enabled and running and I've also implemented my own iThemeSelector. Do they both get executed in a particular order?

I'm rapidly getting up to speed on Orchard and hope to participate much more on this forumn as I develop my Orchard applications.

Thanks! Just out of interest (and to get more of a handle how this works...) what would happen if the Vandeley theme selector is enabled and running and I've also implemented my own iThemeSelector. Do they both get executed in a particular order?

I'm rapidly getting up to speed on Orchard and hope to participate much more on this forumn as I develop my Orchard applications.

Thanks! I'm looking into the Vandelay Theme Selector and playing around with how it works. I'm trying to modify it so that I can select a theme based on what 'page' is selected. With this in mind I was thinking of showing a dropdown of all Content Types
with a type of 'Page' and allowing the administrator to select a theme per chosen page. This is because I intend to have a site where lots of companies will have thier own page and I want to Theme/Brand it accordingly.

How do I create/attach a field in the custom module (View) that is populated with all 'pages'?