Drupal 7.x Installation Instructions

This guide will show you how to install and activate the Drupal 7.x 51Degrees.mobi plugin. Before continuing you will need to have your PHP environment set up and Drupal already installed. Learn more about installing Drupal on their website: http://www.drupal.org

1. Download the latest version of 51Degrees.mobi Detection Module.

2. The plugin will need to be uploaded to your Drupal site. You can do this by going to the modules page after you've logged in as an admin. Look for an 'Install New Modules' button.

If this button is available you can go straight to step 3. If you have not installed a plugin before or your site has not been set to check for updates you will need to enable the Update Manager in the modules list.

  • Find Update manager in the module list and mark the checkbox.
  • Find and press the 'Save Configuration' button.
  • Update manager should now be enabled, and you will see a 'Install New Module' link at the top of the modules page.

3. Press the 'Install New Module' link. This will take you to a page asking for the package location or the file location to upload a plugin from.

4. Press the 'Choose File' button and find the plugin zip file downloaded earlier and then press 'Install'.

5. After the plugin is upload it must be enabled. Either go to 'Enable uploaded plugins' or navigate back to the module menu.

There, check the box next to the 51Degrees.mobi Plugin and click 'Save Configuration'.

You should see a 51Degrees.mobi menu option in the admin area that will allow you to create rules to configure which themes are served to devices.

Testing Your Drupal Module

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