Reputation: 8226
UPDATED MY QUESTION
I am trying to implement the seperate template for mobile view using zend framework. I am following this guide
I have the following plugin called Mobile.php
<?php
class ZC_Controller_Plugin_Mobile extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
$bootstrap = Zend_Controller_Front::getInstance()->getParam("bootstrap");
$useragent = $bootstrap->getResource("useragent");
$device = $useragent->getDevice();
Zend_Registry::set("useragent", $useragent);
Zend_Registry::set("device", $device);
/**
* @todo change this to be Mobile
*/
echo $device->getType() . " is the type of device";
}
}
This works in Desktop view.I got desktop is the type of device
as the output when i run the site.When check the same , i got the following Application error,
I am getting the error in this following line when i run site on mobile $device = $useragent->getDevice();
Kindly advice on this
Upvotes: 1
Views: 1231
Reputation: 69957
It appears that Zend Framework currently only works with WURFL version 1.0
and 1.1
(see Zend_Http_UserAgent_Features_Adapter_WurflApi
).
Unfortunately, only the latest 2 versions are available and the older versions were pulled for some reason and are not available for download from SourceForge. You have a newer version 1.3.0
. 1.3.1
is the latest version as of writing.
I couldn't find the 1.1
version anywhere except for one site here. I don't know the source, or the integrity of the version posted there, but I looked through a lot of the files and it looks like what you need.
I would recommend downloading that version and replacing the other files with these and see if the error goes away.
Hope that helps.
Upvotes: 2