Drupal Mobile: How to create a Drupal mobile site without using Mobile Tools

August 18, 2011
Mobile Phone

Last year, we talked about using the Mobile Tools module to create mobile sites in Drupal.  We use and appreciate Mobile Tools, but we recently had a requirement that made us look into other options. We needed one domain to serve two different mobile sites. Mobile Tools works well with one mobile site, but we didn't see a way to serve two mobile themes.

For this client, we were already using ThemeKey and we knew the ThemeKey module can test for mobile devices. Out-of-the-box, ThemeKey tests by platform. We didn't want a rule for every device targeted, we needed an easier way to target mobile browsers.  We added MobileKey to the mix and now we can test for desktop, mobile or a specific platform.

Note: We also could have paired Wurfl with ThemeKey to test for mobile browsers, but we don't have sufficient access to this particular server to add Wurfl's requirements (Pear::Log library).

Mobilizing, at a glance with ThemeKey

  1. Install ThemeKey
  2. Install MobileKey
  3. Install mobile theme (We are using Fusion Mobile)
  4. Configure theme switching (see example below)
  5. Style mobile theme to appropriate design

Here are a few thoughts when using ThemeKey:

  • ThemeKey doesn't handle domain redirection, if you need that.
  • We noticed a need to add the code to remove the address bar in the mobile browser.
  • You will need to test for desktop and mobile separately. In my screenprint of the rules, you will see that I've used !(not) desktop, this is only for development. I'll switch to test for mobile.

themekey.gif

You can see from one of my older posts, that I have recently returned to Drupal after several years away ... I am not an expert. What do you think about my approach? Would you do anything differently? I'd love your input.

Related posts

 

photo by ciccioetneo

Comments

Thanks for sharing.

Thanks for sharing.

Nice write up! How would you

Nice write up!

How would you handle page caching using varnish etc. if its based on the user agent string?

Kim

Pingback

[...] Digett: Drupal Mobile: How to create a Drupal mobile site without using Mobile Tools [...]