Introducción a Zend Framework

 Aprendiendo Zend Framework


 Referencia de Zend Framework

  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    25.10. Additional informations on Zend_Currency

    25.10.1. Currency informations

    Sometimes it is necessary to get informations which are related to a currency. Zend_Currency provides you with several methods to get this informations. Available methods include the following:

    • getCurrencyList(): Returns a list of all currencies which are used in the given region as array. Defaults to the objects locale when no region has been given.

    • getLocale(): Returns the set locale for the actual currency.

    • getName(): Returns the full name for the actual currency. When there is no full name available for the actual currency, it will return the abbreviation for it.

    • getRegionList(): Returns a list of all regions where this currency is used as array. Defaults to the objects currency when no currency has been given.

    • getService(): Returns the set exchange service object for the actual currency.

    • getShortName(): Returns the abbreviation for the actual currency.

    • getSymbol(): Returns the currency sign for the currency. When the currency has no symbol, then it will return the abbreviation for it.

    • getValue(): Returns the set value for the actual currency.

    Let's see some code snippets as example:

    $currency = new Zend_Currency();

    // returns 0

    // could return an array with all regions where USD is used

    // returns an array with all regions where EUR is used

    // could return 'US Dollar'

    // returns 'Euro'

    As you can see, several methods allow to use additional parameters to override the actual object to get informations for other currencies. Omitting this parameters will return informations from the actual set currency.

    25.10.2. Currency Performance Optimization

    Zend_Currency's performance can be optimized using Zend_Cache. The static method Zend_Currency::setCache($cache) accepts one option: a Zend_Cache adapter. If the cache adapter is set, the localization data which is used by Zend_Currency will be cached. Additionally there are some static methods for manipulating the cache: getCache(), hasCache(), clearCache() and removeCache().

    Ejemplo 25.6. Caching currencies

    // creating a cache object
    $cache Zend_Cache::factory('Core',
    'lifetime' => 120,
    'automatic_serialization' => true),
    => dirname(__FILE__) . '/_files/'));

    digg delicious meneame google twitter technorati facebook