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'])
This entry was posted in DotKernel and tagged DotKernel, WURFL, Zend Framework. Bookmark the permalink.
Denis November 29, 2010 at 1:49 pm
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
Pingback: Disable automatic redirect for mobile browsers in DotKernel | DotKernel PHP Application Framework