There's basically four types of internet capable phones:
- Full HTML (e.g. iPhone)
- Strict XHTML (e.g. Nokia N95)
- imode (still used and popular in Asia)
- WAP (Noka 3310)
From my point of view I'd like to add the ability to further split the mobile themes. We can now only set 1 theme, meaning we have to catch every function internally using WURFL. We could make it a bit easier to develop themes, if we could separate mobile themes into these four basic groups. And set a theme for each one. A basic mobile_tools device detection script (or using wurlf) could figure out what theme to show, based on the device's user agent.
Any ideas? Its just a thought. I used to do it like this with the "accessibility" module from skiffie.com
Comments
Comment #1
twom commentedHi,
As you will see, the mobile tools module provides a hook for other modules to detect if a user is coming from a mobile device.
I would like to extend this hook towards providing more information e.g.
hook_mobile_device_groups() {
// returns an array of device groups that the module can detect
}
the theme switching component of the mobile_tools module uses this information to present a form where you can define which theme for which devices.
hook_is_mobile_device() {
// returns what group of mobile device the visiting device belongs too
}
Is this what you are looking for?
I can already implement a basic group-detection in the mobile_tools module. I have also made a wurfl module: http://drupal.org/project/wurfl. This module can provide more groups upon which you can base your theme switching.
I am currently on holidays (starting from today ;)). So I will not be able to implement this, but I will be happy to do so when I return (5th may). Feel free to provide some patches already!
Tom
Comment #2
twom commentedComment #3
twom commentedI implemented the feature where you can do theme switching based on device group.
Currently the mobile tools module natively supports: iphone', 'ipod', 'android', 'opera mini', 'blackberry'
I'll see if I can add iMode or WAP.
I implemented a new hook:
hook_device_groups() -> Third party module can provide their own implementations for providing groups.
these modules must also have the
hook_is_mobile_device() hook. This hook does the device detection and returns an array:
array('group' => 'iphone', 'type' => 'mobile') -> e.g. for iphone
array('group' => '', 'type' => 'desktop') for a desktop site.
Please test!
Comment #4
twom commentedComment #5
Anonymous (not verified) commentedSorry for the extremely slow response... But I found a solution for an "official" theme switch, based on WURFL.
First of all, I propose to switch themes by official markup languages:
http://wurfl.sourceforge.net/help_doc.php#markup
These are about 14 types, which can be grouped in to the four I mentioned last year.
WML: wml_1_1, wml_1_2, wml_1_3
XHTML: html_wi_w3_xhtmlbasic, html_wi_oma_xhtmlmp_1_0
iMODE: html_wi_imode_html_1, etc.
Web: html_web_3_2 etc. (which is many Blackberrys, iPhone etc.)
In wurfl.module: add this function:
Then you also have to extend the wurfl_is_mobile_device() function like this:
You have 13 theme options, but with 4 themes you can cover them all: WML, XHTML, IMODE, WEB (full html)
I also noticed a bug in WURFL.module:
return $requetingDevice->getCapability($capability);should be
return $requestingDevice->getCapability($capability);+tI also have a suggestion: allowing SPECIFIC targeting of a device. For example, allow adding custom themes for only iPhone V3 etc. That should be easy with WURFL integration: simple match a (groupp of) User Agents with a theme group. For now I'm satisfied, but imagine the marketing power! You could target specific ads blocks to iPhone v3 only.
@twom: Maybe you can add this to the WURFL module?
Comment #6
minoroffense commented1.x is no longer supported