| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Modifying Which Devices Belong to What Families

Page history last edited by PBworks 13 years, 9 months ago

This documentation is for version 2 of Mobile Web OSP.

 

There are two parts to determining which device belongs to which classification and then which templates are shown for that classification.

 

Classifying a Device

To classify a device (e.g. a Blackberry as a 'smart_phone') you must edit the classify_phone() function in web/page_builder/Page.php. It appears at line #138. The basic concept is to take a device's user agent string, parse it, and determine which type of device family it falls into. If there is a new device on the market that you want to provide either custom templates for or to separate it from older devices with similar user agents this is where you would make the change. By default the following classifications are supported:

 

  • android: all Android-based devices
  • computer: iPad, regular desktops or devices not recognized by the classification system
  • feature_phone: all internet-ready features phones like the Motorola RAZR
  • iphone2: iPhone & iPod Touch devices running iPhone OS 2
  • iphone3: iPhone & iPod Touch devices running iPhone OS 3 or greater
  • opera: devices using the Opera Mini browser
  • palm: all webOS-based devices
  • smart_phone: Blackberry, older Palm handhelds, Windows Mobile

 

Determining Which Templates are Used for a Device

There are three sets of templates a device can use. They are:

 

  • webkit: uses HTML5, CSS3, and JavaScript by leveraging jQTouch. Not all WebKit-based browsers are supported. Notably iPhone OS 2 devices and Palm Pre which seems to fail on some of the CSS3 pseudo-selectors.
  • touch: the original 'ip' templates from version 1 of Mobile Web OSP
  • basic: the original 'sp' templates from version 1 of Mobile Web OSP

 

In order to assign a classification to a template you will need to edit the $phoneTable array found on line #123 of web/page_builder/Page.php. By default Mobile Web OSP ships with the following classification to template arrangment:

 

  • android => webkit
  • computer => basic
  • feature_phone => basic 
  • iphone2 => touch
  • iphone3 => webkit
  • opera => touch
  • palm => touch
  • smart_phone => basic 
  • spider => basic

 

You can either change which templates should be served to a classification by changing the template to either basic, touch, or webkit. If you add a new classification in the first part you'll have to add a line to the array and list the classification to template relationship.

 

Note: The template also determines how statistics are recorded for the device. So when statistics for an Android device are recorded they're added to the webkit field in the database.

Comments (0)

You don't have permission to comment on this page.