Quick setup
The 51Degrees.mobi Switcher can be used to control whether a particular kind of device will use a certain Drupal theme or if it will redirect to a different URL. The plugin can have multiple rules set up at once so a different
theme can be setup for mobiles, tablets, input methods or any other data provided by the 51Degrees.mobi
Provider.
After installing the 51Degrees.mobi Device Detection Drupal plugin, open the plugin menu by clicking the 51Degrees.mobi link from the
admin area.
You will see the following screen:
Start by creating your first rule by pressing the 'Add New Rule' button. This will refresh the
page showing a screen with a single tab. Each tab represents a single rule, each with options to
specify detection conditions and their output.
Let's create a rule that will switch to the "Bartik" theme for all mobile devices:
1. Check the 'Mobile' mobile checkbox in basic properties. Additional basic properties from the yellow
box can be enabled by using our Premium device data.
2. Advanced properties can be used to go into more detail about what devices should be switched, such
as the manufacturer or input methods. We don't need to complete this for now so we can ignore it.
3. Finally, set which action should be taken. The drop down list has all currently listed themes and
an extra option for specifying if a different URL should be used. Select the "Bartik" theme and press
the 'Save Rule' button.
4. You should now be able to visit the site from a mobile device or mobile emulator to see your site responding
to the device with the "Bartik" theme. We used "Bartik" as an example, a site may use any number of
device optmised themes to ensure
a great mobile web user experience.
Note that Drupal caches theme responses externally from the 51Degrees.mobi plugin, so if it appears your
device is not seeing theme changes try clearing your device's cache.
Multiple Rules
An unlimited amount of rules can be created, allowing for different device and property combinations to be redirected to different themes or sites.
You can create new rules by pressing the 'Add New Rule' button. A new tab will be added and will be given a unique name. The rule name can be changed by overwriting the textbox
in the tab and pressing 'Save Rule'.
Rules must have a unique name. If a Rule's name is changed to be the same as an older Rule, the older
Rule will be overwritten and take the properties of the new Rule.
The positioning of the tabs affect their priority. If two Rules clash over a device the Rule that was encountered
first (ie, the left most tab) will be used. You should have your most specific Rules on the left going
to least specific Rule on the right.
The order of the tabs can be changed using the '<' and '>' buttons on the selected tab. These
options are only available when the tab is allowed to move in that particular direction.
If no matches are found the default theme and requesting URL are used.
Advanced Properties
Properties in the 'Basic Properties' section are chosen because they are frequently used and are helpful for developers. We keep them in one place, to allow for ease of use. Also, unlike the 'Advanced Properties' section they
are evaluated on an "OR" basis.
Any device that was true for at least one of the following properties would satisfy that Rule:
Mobile
Tablet
Console
This allows developers
to quickly make Rules that cover a lot of devices, rather than having multiple Rules with the same action.
However, if more detail is required then the Advanced Properties can be used. These properties are
evaluated on an "AND" basis. First, they must be enabled via the checkbox, then their desired value
set in the drop down box. By having the separate enabling step a Rule can check if the property should
be false.
Note that if basic and advanced properties are mixed in the same Rule, only a single Basic Property
needs to match for the Rule to be satisfied, even if none of the Advanced Properties match.
Settings
You may enable this to contribute data to 51Degrees.mobi to help us create better detection data.
Data is annoymous and not shared with any other party. See our Share Usage FAQ for more info.
Upgrade To Premium Device Detection Data
Once you have purchased our Premium Device Data license key you can update your detection data by copying the key into the box
and pressing 'Update Data'. If a newer version than currently installed is available the data will be downloaded and installed. Note
that your server needs to support outbound HTTP connections and be given file writing permission for
this process to work.
Buy Premium