How do I configure Mobile Tools/Themekey to switch themes?

Using Themekey 2.0 and Mobile Tools 3.x-dev

Comments

jlea9378’s picture

anyone?

jlea9378’s picture

minoroffense’s picture

We're working on the UI elements of that. For the moment, you can only trigger it with several lines of PHP code.

It's really not ready for public use. The code is being actively developed right now. I'll post a notice on the front page when it's ready to be tested.

jlea9378’s picture

ok thx

minoroffense’s picture

Status: Active » Needs review

You can try the themekey integration now on the dev release. Be sure you follow the README and INSTALL files for modules to install (essentially, you need dev everything ;-)

minoroffense’s picture

Status: Needs review » Closed (fixed)
dark_kz’s picture

So I downloaded last dev version of Themekey released November 27 and open Readme file. I don't any manual to configure with mobile tools?

How do I configure Mobile Tools/Themekey to switch themes?

jlea9378’s picture

Status: Closed (fixed) » Active

I'm not sure how to get Mobile Tools working. I installed dev everything but I still can't figure out how to get it to work.

It appears that Browscap is needed, but there is a bug in the patch (which is needed to get rid of an error). However the bug in the patch causes a different error.

I am confused by the fact that Browscap is listed as optional. From what I've read, it doesn't seem like Mobile Tools 7.x-3.x has device detection without Browscap, so how can Browscap be optional?

jlea9378’s picture

FYI there are two patches needed to get Browscap working:
http://drupal.org/node/1713570
http://drupal.org/node/1868808

Still not sure how to actually get Mobile Tools to switch themes though.

jbarwick’s picture

In order to get Browsecap to work with Mobile Tools, I had to install two patches to browscap.

Ok, so far so good. Browscap works and is choosing the correct record. Mobile_Tools works as it recognizes the browscap and, if you have redirect on you can see that Mobile_Tools redirects the URL.

Now, the problem...ThemeKey

The "SwitchTheme" in Mobile_Tools isn't working. No idea why. But, in my opinion Mobile Tools should simply inject a rule into ThemeKey ...

So, I like the answer #3 (I don't like the 'get dev everything answer...I think I do, but it aint working...I'll read the readme's again)

So, I added my own rule to ThemeKey

if (browscap:ismobiledevice=true) then set theme to "mobile"

You would think this would work. Alas it does not. I suspect it has something to do with the patches that were applied to browscap and the fact that I am
using PHP 5.4.

The field in browscap is tinyint(4)--- browscp.ismobiledevice tinyint(4) null default 0

And, I think PHP 5.4 is barfing at 'true' == 1. Dunno why.

In any case, I got ThemeKey to work by adding the rule:

if (browscap:browser='IEMobile' and browscap:platform='WinCE') then set theme to "mobile"

Voilà!!

or you could do if (browscap:parent='IEMobile') then set theme to "mobile"

Now, this would then not be using Mobile Tools at all. So far I have browscap and themekey working quite well. Not sure why I need Mobile Tools yet. But as I'm just getting started, I just might find the Context stuff useful...dunno. I'm not sure if I want a completely separate them or if I simply want to change formats based on context....I think I want a theme for Windows Mobile, Windows Phone, iOS, and Android...a lot of theme writing...but this is where ThemeKey rules will work and Mobile_tools will not (based on the current UI...that doesn't work [yet] anyway)...

But...I really really like the idea about the browscap "grouping" and parent selection. I'd love it if Mobile_Tools would inject a rule into ThemeKey:

if (mobiletools:group='mobiletoolsgroupname') then set theme to "mobile"

and you could move around the rule once created and wrap it however you like... and let ThemeKey do the work.

Hope this helped.