Errors when implementing WURFL with Zend

2019-07-20 08:13发布

I've looked around and cant seem to find someone with the same issue as me, hoping i've not missed a clanger here.

I'm wanting to get device browser information for each user, i'm currently planning on doing this within the bootstrapper, following something i saw in PHP conference.

To that end i came across:

http://framework.zend.com/manual/en/zend.http.user-agent.html

Which explains how to install and use wurfl. I've followed the instructions and am coming up with the following exception:

Uncaught exception 'Zend_Http_UserAgent_Features_Exception' with message '"wurflapi" configuration is not defined'

My limited understanding of Zend leads me to think the issue is within configs/application.ini

I have the following:

resources.useragent.wurflapi.wurfl_api_version  = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.1/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"

Where my wurfl-config.php looks like:

echo "Loaded";
die;
$resourcesDir            = dirname(__FILE__) . '/../../data/wurlf/';
$wurfl['main-file']      = $resourcesDir  . 'wurfl-latest.zip';
$wurfl['patches']        = array($resourcesDir . 'web_browsers_patch.xml');
$persistence['provider'] = 'file';
$persistence['dir']      = CACHE_ROOT . "/wurfl/";
$cache['provider']       = null;

$configuration['wurfl']       = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache']       = $cache;

I'm expecting the script to die after priting loaded, but i'm not getting this, meaning the config isnt loading correctly.

Where might be the problem? What more information do you require? Has anyone else come across this dilemma before?

Thanks in advance

1条回答
成全新的幸福
2楼-- · 2019-07-20 09:12

Seems that you're unable to do what i want.

In that this doesnt seem to want to work within a bootstrap. Instead you should do this as a plugin.

This video tutorial helps explain the documentation a little better:

http://mcloide.wordpress.com/2010/12/08/mobile-development-with-zend-framework-and-wurfl/

Now that i have setup the plugin i dont get the exception and my config loads perfectly. Humpf!!

查看更多
登录 后发表回答