ZikulaTemplate_Plugins
[ class tree: ZikulaTemplate_Plugins ] [ index: ZikulaTemplate_Plugins ] [ all elements ]

Source for file function.get_country_name_for_country_code.php

Documentation is available at function.get_country_name_for_country_code.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2004, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: outputfilter.pagevars.php 19321 2006-06-29 13:15:10Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package ZikulaTemplate_Plugins
  10.  * @subpackage Functions
  11.  */
  12.  
  13. /**
  14.  * Smarty function to get a country name from a given country name
  15.  *
  16.  * Available parameters:
  17.  *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  18.  *   - code:     Country code to get the corresponding name for
  19.  *
  20.  * Example
  21.  *   <!--[get_country_name_for_country_code  code=ZZ]-->
  22.  *
  23.  *
  24.  * @author      Robert Gasch
  25.  * @since        12 December 2007
  26.  * @param       array       $params      All attributes passed to this function from the template
  27.  * @param       object      &$smarty     Reference to the Smarty object
  28.  * @return      string      the value of the last status message posted, or void if no status message exists
  29.  */
  30. {
  31.     $code   = isset($params['code'])   $params['code']   'ZZ';
  32.     $assign = isset($params['assign']$params['assign'null;
  33.  
  34.     $countries countrylist();
  35.     if (isset($countries[$code])) 
  36.         $result $countries[$code];
  37.     else {
  38.         $result $countries['ZZ'];
  39.     }
  40.  
  41.     if ($assign{
  42.         $smarty->assign ($assign$result);
  43.     else {
  44.         return $result;
  45.     }
  46. }

Documentation generated on Fri, 18 Jul 2008 21:45:20 +0200 by phpDocumentor 1.4.1