Switch theme by path ... oh so easy if you remember how ...
I'm in the middle of developing a site for an information project and needed to create links to switch themes via links offered in a block. While I'm taking advantage of the Browscap integration of the Switchtheme module to identify the user agent and then present either the mobile or desktop version of the site, its always nice to have a manual option too.
The module comes with a drop-down offering, but it doesn't really fit in with the client's custom theme and it s a bit cumbersome. So, simples, create a block, drop a couple of links in, choose where to display and off we go.
Or so I thought, until I didn't quite remember the path to switch themes...
This is *really* simple, but you do have to retain the detail in your noggin, because, when I went to check, I didn't really find a quick answer. Maybe it is documented somewhere, but I didn't find it. Anyway, here is the principle (replace with you own domain and theme names):
http://mydomain.name/?theme=mythemenamehere
But there's a couple of things to note in order for this approach to work:
- The theme name you use in this path is name of the directory in which the theme is located;
- It is not the name of the theme itself, as expressed in your .info file;
- It appears to be case sensitive - we are using the Mobile theme for the mobile offering, the theme may be "Mobile" but the directory was called "mobile". Add 5 minutes for working out why /?theme=Mobile wouldn't work... /?theme=mobile did, of course...
So there we go. The simplest of things. The things you have done before. The things you think you know. But actually the things you forget...