Mobile Drupal Sites - The most flexible way ever?
The past few months I've been working on a Drupal site and one requirement was for a mobile site. It needed to be a scaled down version of the site, with of course a simplified theme, and only a few features.
Conventional wisdom seems to say that my two options for a mobile site are either build a separate site, and redirect users based on the device they come in on, or I could just switch themes and style sheets and make my modifications there. But I'm using a content management system. I shouldn't have to build two sites, right? Right! ..that's when I came up with this solution:
This year, Earl Miles (merlinofchaos) has been putting a lot of work in to Panels 3. As a part of the new version he has extracted some parts of it and put it into the "ctools" module package. One in particular is called Delegator. In true merlinofchaos fashion, this is a very flexible module that gives a lot of options. It lets you re-route pages like the node page or user page, or custom pages to a panel, based on rules. One of the possible rules is to route based on user roles, so that a user that's say, a moderator, can see a completely different panel than an authenticated user. This opens doors to all kind of possibilities.
So now, imagine you could route to a different panel based on device type. Well with one extra module, you can. The mobile tools module has a small feature that allows you to specify a "mobile role" for any of your pre-existing roles. So, for example, all Drupal sites have the "authenticated user" role as well as the "anonymous user" role. Mobile tools allows you to assign a mobile equivalent of each of these.
So, couple these two relatively new modules together, and you can serve up 100% different, or 50% different panels, or whatever you want, based on the same database and content, without having to enter in to Drupal multi sites.
Mobile tools also allows you to switch themes based on different devices, so you now have a fully flexible, completely customizable mobile site. Not bad, eh?


Comments
Mobile phones
Mobile phones is most important and it using everyone in the world.has been putt a lot of work in to Panels tools.someone had the phone to get his mobile phone number reactivated after his handset was stolen and there are Communications to each other.Mobile tools also allows to switch themes based on different devices, so that have a fully flexible, completely customizable mobile site.
The notion of just using
The notion of just using special panel layouts for mobile surfing is really awesome. I'm just getting more and more frustrated though since I can't get it to work at all.
Choosing Mobile Browser as selection rule does nothing, no matter which user agent I use (Iphone, Blackberry etc...) the panel isn't used.
Creating a Selection Rule for anonymous roles (mobile) as you suggest therefore seem like the alternative way to go, but a selection rule for user roles can only be set for logged in users (the idea of logged in anonymous users is pretty strange in itself) so I'm left stranded.
Both Panels and Views are truly great modules, but I'm time and again put of by their extreme counter-intuitiveness in function (in combination with the lack of documentation).
Anonymous Mobile
While it may seem counter-intuitive like you say, the mobile tools module actually does create a mobile-anonymous role which can be used for panels selection. I'm using it on several sites and works quite nicely.
It does take some time to get the hang of Panels and Views, but it's worth hanging in there. I definitely recommend hanging out in the Drupal IRC chat rooms to get some insight on their functions if you have any questions. The issue ques on both panels and views are also very active and you can ask questions there. Ultimately, if you're a coder, the best way to understand them both is to dive into code. Earl Miles is one of the most innovative coders in Drupal and you can learn a lot from studying his work.
Post new comment