title: Detect Mobile view in zend framework not happening?
body: <pre><code>UPDATED MY QUESTION
  </code></pre>
  
  <p>I am trying to implement the seperate template for mobile view using zend framework. I am following this <a href="http://framework.zend.com/manual/en/zend.http.user-agent.html#zend.http.user-agent.quick-start" rel="nofollow noreferrer">guide</a></p>
  
  <p>I have the following plugin called <code>Mobile.php</code></p>
  
  <pre><code>&lt;?php
  
  class ZC_Controller_Plugin_Mobile extends Zend_Controller_Plugin_Abstract 
  {
      public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { 
  
      $bootstrap  = Zend_Controller_Front::getInstance()-&gt;getParam("bootstrap"); 
      $useragent  = $bootstrap-&gt;getResource("useragent"); 
      $device     = $useragent-&gt;getDevice(); 
  
      Zend_Registry::set("useragent", $useragent);
      Zend_Registry::set("device", $device);
  
      /**
       * @todo change this to be Mobile 
       */
  
      echo $device-&gt;getType() . " is the type of device";
  
  }
  
  }
  </code></pre>
  
  <p>This works in Desktop view.I got <code>desktop is the type of device</code> as the output when i run the site.When check the same , i got the following Application error,</p>
  
  <p><img src="https://i.stack.imgur.com/b9sVR.jpg" alt="enter image description here"></p>
  
  <p>I am getting the error in this following line when i run site on mobile              <code>$device     = $useragent-&gt;getDevice();</code> </p>
  
  <p>Kindly advice on this</p>