UserAgent View HelperOverview
This view helper provides the ability to inject and later retrieve a
Zend_Http_UserAgent instance for use in branching display logic
based on device capabilities.
Quick Start
In most cases, you can simply retrieve the User-Agent and related device by calling the
helper. If the UserAgent was configured in the
bootstrap, that instance will be injected already in the helper; otherwise, it
will instantiate one for you.
userAgent()->getDevice()->hasFlash()): ?>
]]>
If you initialize the UserAgent object manually, you can still
inject it into the helper, in one of two ways.
getHelper('userAgent');
$helper->setUserAgent($userAgent);
// Pass the UserAgent to the helper:
$view->userAgent($userAgent);
]]>Available MethodsuserAgentZend_Http_UserAgent $userAgent = null
Use this method to set or retrieve the UserAgent
instance. Passing an instance will set it; passing no arguments will retrieve
it. If no previous instance has been registered, one will be lazy-loaded using
defaults.
setUserAgentZend_Http_UserAgent $userAgent
If you have an instance of the helper -- for instance, by calling the view
object's getHelper() method -- you may use this method
to set the UserAgent instance.
getUserAgent
Retrieves the UserAgent instance; if none is registered,
it will lazy-load one using default values.