The UserAgent Device InterfaceOverviewOnce the User-Agent has been parsed and capabilities retrieved from the Features adapter, you will be returned an object that represents the discovered brower device. This interface describes the various capabilities you may now introspect. Additionally, the various device classes define algorithms for matching the devices they describe. By implementing this interface, you may provide additional logic around these capabilities. Quick StartThe Zend_Http_UserAgent_Device interface defines the following methods. The static function match() should be used to determine whether the provided User-Agent and environment (represented by the $server variable) match this device. If they do, the Zend_Http_UserAgent class will then create an instance of the class, passing it the User-Agent, $server array, and any configuration available; at this time, it is expected that the Device class will consult with a features adapter, if present, and populate itself with discovered capabilities. In practice, you will likely extend Zend_Http_UserAgent_AbstractDevice, which provides functionality around discovering capabilities from the User-Agent string itself, as well as discovering and querying a Features adapter. Configuration OptionsConfiguration options are defined on a per-device basis. The following options are defined in Zend_Http_UserAgent_AbstractDevice. Like all options, the "." character represents an additional level of depth to the configuration array.
Device OptionsAvailable Methods
ExamplesExample #1 Determining Supported Features You may wish to direct the user to specific areas of your site based on features supported by the device they are using. For instance, if a particular app works only in Flash, you might direct a non-Flash-capable device to a page indicating the application will not work on their device; or for a device not capable of HTTPS, you may indicate certain actions, such as purchases, are not available.
Example #2 Dynamically Scaling Images You may wish to alter the image sizes present in order to achieve a specific design within mobile devices. You may use a variety of methods in the device object to make this happen.
|
|