This post refers to DotKernel 1, based on Zend Framework 1.
If you are looking for DotKernel 3 related posts, go here.

WURFL is integrated into DotKernel, using the Zend_Http_UserAgent class from the latest release ZF 1.11.0rc1 ( Beta release at the date of this post).

The integration of WURFL into DotKernel is described below.

Download WURFL PHP API and unzip it into folder wurfl-php-1.1

  • Create folders and make it writable by web server
    • cache\wurfl\FILE_CACHE_PROVIDER
    • cache\wurfl\FILE_PERSISTENCE_PROVIDER
  • In folder configs:
    • Copy wurfl-config.xml from wurfl-php-1.1\examples\resources
    • Rename wurfl-config.xml to wurfl.xml
  • Edit configs\application.ini file; add these lines:
resources.useragent.wurflapi.wurfl_api_version = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/library/Wurfl/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl.xml"
  • Create folder externals\wurfl, and copy the following files from:
    • wurfl-php-1.1\examples\resources\web_browsers_patch.xml
    • wurfl-php-1.1\examples\resources\wurfl-regression.zip and rename it wurfl.zip or download the latest wurfl zip database and rename it wurfl.zip
  • Copy the contents of the folder wurfl-php-1.1\WURFL to library\Wurfl

WURFL is integrated into DotKernel in the mobile module, but to access WURFL configuration, use

$userAgent = new Zend_Http_UserAgent($config->resources->useragent);
$device = $userAgent->getDevice();

$userAgent->getDevice() returns all the relevant information about the current user agent ($_SERVER[‘HTTP_USER_AGENT’])

2 Comments

  1. Denis

    I’m experiencing problem with androids based phone as soon as ::
    $this->_bootstrap->getResource(‘useragent’)->getDevice();
    is executed it tells me that the site has “too many redirects”.While other platforms works well and doesn’t complain.

    Thank you

  2. Disable automatic redirect for mobile browsers in DotKernel | DotKernel PHP Application Framework

    […] Wurfl is currently used to detect mobile browsers and automatically redirect them to the mobile site the first time they view the homepage. Sometimes, this behavior isn’t desired (for example when you don’t have a mobile site, or you don’t plan on using Wurfl at all) […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>