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

Source for file function.assign_arrayval.php

Documentation is available at function.assign_arrayval.php

  1. <?php
  2. /** ----------------------------------------------------------------------
  3.  *  LICENSE
  4.  *
  5.  *  This program is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU General Public License (GPL)
  7.  *  as published by the Free Software Foundation; either version 2
  8.  *  of the License, or (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WIthOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  To read the license please visit http://www.gnu.org/copyleft/gpl.html
  16.  *  ----------------------------------------------------------------------
  17.  *  Original Author of  Robert Gasch
  18.  *  Author Contact: r.gasch@chello.nl, robert.gasch@value4business.com
  19.  *  Purpose of file: assign the specified smarty variable
  20.  *  Copyright: Value4Business GmbH
  21.  *  ----------------------------------------------------------------------
  22.  * @package Zikula_Template_Plugins
  23.  * @subpackage Functions
  24.  */
  25.  
  26. /**
  27.  * assign an array key to the specified value
  28.  *
  29.  * @author    Robert Gasch
  30.  * @version     $Id: function.assign_arrayval.php,v 1.1 2005/01/21 11:10:20 rgasch Exp $
  31.  * @param    array           the array we wish to get an element from
  32.  * @param    key         the array key we wish to retrieve
  33.  * @param    assign          the smarty variable to assign the result to
  34.  */ 
  35. function smarty_function_assign_arrayval ($params&$smarty
  36. {
  37.     $array  = isset($params['array'])  $params['array']  array();
  38.     $key    = isset($params['key'])    $params['key']    '';
  39.     $assign = isset($params['assign']$params['assign'$key;
  40.  
  41.     $val = isset($array[$key]$array[$keynull;
  42.     $smarty->assign($assign$val);
  43. }

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