By albertc on
Hi
I want to provide a menu option for applying the 'mobile' theme to my site. I guess it must be possible to switch between Drupal themes by adding some parameter to the URL. Can somebody explain if such an option exists and what's the format to use in the URL?
Thanks in advance
--
Albert
Comments
Switching themes
By a 'mobile' theme, do you mean a theme designed for handheld devices? If this is the case, then you don't need a different theme at all; just use CSS At Rules to specify which styles are for which media types (e.g. screen, handheld, print, etc.).
As for adding a parameter to the URL to set the theme, I don't know. You might, however, (depending on why you need this feature) want to allow your users to change the stylesheet via javascript. There are several ways of doing this. There's a good article on this subject you may want to take a look at (although it is for web pages in general, rather than Drupal-specific). I hope this helps.
~ Dave ~
Thanks, but no thanks
Dave
Thank you for your reply. The CSS information you provided looks very helpful, and I'm sure it will come handy someday. However, I had already installed the 'mobile' theme (downloadable from http://drupal.org/project/mobile ), and what I need now is a way to force it (or any other theme, let's say for changing from Bluemarine to Chameleon, and so on) from the URL itself.
I remember to have seen something like http://exemple.com/?theme=newthemename somewhere, but I've tried and it doesn't work in my site.
Anyone else can help with such a syntax, or is it simply that I'm wrong and it can't be done?
Thanks in advance
--
Albert
the switch_theme module is what you need
hi again.
what you need to achieve this is the switch theme module
once installed and activated you can switch themes in 2 ways:
Mohammed al-shar'
The Explorer
nattiq Thank you! This is
nattiq
Thank you! This is just what I needed
--
Albert
This works
This works for me, Drupal 7.14
I'm loading my Drupal blog posts into an iFrame on another website, and need to use a different theme for the iFrame situation.
Works great!
optional style sheet configured by visitors
hi,
although I never had luck in as far as this goes, but here we go!
Optional CSS configurable by your visitors
let me know if this ever works with you, I wish it did work for me, instead it ruined my site.
I asked for help here but got no reply, so I hope some could give it a look once again and suggest why it's not working for me?
and Dave, thanks alot for the style switcher article, I hope it is going to work for me.
Mohammed al-shar'
The Explorer
optional style sheet configured by visitors
Yeah, I also had problems with letting users customize their own css. The main problem (I think) is that there end up being conflicts between the site's css stylesheet and the user's css. Since most users won't take a close look at all of the tags, classes, and ids your pages use and they won't look at the default css your site provides, this can happen a lot.
Good luck with the style switcher; it can be really nice once you get it working.
~ Dave ~
It's a bit late but...
I had trouble using this with Drupal 5 at first but I got it working now. If you're interested see the comments on the snippet.
@dave this snippet's title is a little misleading, it doesn't let your users configure and change their own CSS tags, it just allows you add an optional CSS stylesheet. (as opposed to change the whole theme with the switch theme module which I'm also using)