Mobile Websites with Drupal

A while ago, I registered two new domains just for fun: robloach.com and robloach.mobi. They were initially put up as redirects to the main site, but then I got an idea of making robloach.mobi a mobile version of robloach.net. I wanted it to display the same information, using the same database, have the same code base, but provide a different look to have it viewable on small screens for mobile phones and devices.

To do this, I first used variable overrides in Drupal's settings.php to set the theme_default value to the mobile theme:
$conf = array('theme_default' => 'mobi');

Although it worked, it wasn't a very clean solution as I had to go into the actual settings.php and code something. There had to be a better solution. As it turns out, there was a better solution, and it was called .mobi and .mobi loader. The module is a very small module that checks if the domain ends in '.mobi', and then if it does, it sets the theme to the mobile theme. Very clean solution, and I really like how it was put together.

Now if you visit robloach.mobi, you'll get a small version of my website.