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

Source for file function.pnblockgetinfo.php

Documentation is available at function.pnblockgetinfo.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: function.pnblockgetinfo.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_Template_Plugins
  10.  * @subpackage Functions
  11.  */
  12.  
  13. /**
  14.  * Smarty function to obtain the a block variable
  15.  *
  16.  * Note: If the name parameter is not set then the assign parameter must be set since there is an array of
  17.  * block variables available.
  18.  *
  19.  * Available parameters:
  20.  *   - bid: the block id
  21.  *   - name: If set the name of the parameter to get otherwise the entire block array is assigned to the template
  22.  *   - assign: If set, the results are assigned to the corresponding variable instead of printed out
  23.  *
  24.  *
  25.  * @author       Mark West
  26.  * @since        17.03.2005
  27.  * @param        array       $params      All attributes passed to this function from the template
  28.  * @param        object      &$smarty     Reference to the Smarty object
  29.  * @return       string      the variables content
  30.  */
  31. function smarty_function_pnblockgetinfo($params&$smarty)
  32. {
  33.     $bid    = isset($params['bid'])    ? (int)$params['bid'0;
  34.     $name   = isset($params['name'])   $params['name']     null;
  35.     $assign = isset($params['assign']$params['assign']   null;
  36.  
  37.     if (!$bid{
  38.         $smarty->trigger_error('pnblockgetinfo: parameter [bid] required');
  39.     }
  40.  
  41.     // get the block info array
  42.     $blockinfo pnBlockGetInfo($bid);
  43.  
  44.     if ($name{
  45.         if ($assign{
  46.             $smarty->assign($assign$blockinfo[$name]);
  47.         else {
  48.             return $blockinfo[$name];
  49.         }
  50.     else {
  51.         // handle the full blockinfo array
  52.         if ($assign{
  53.                 $smarty->assign($assign$blockinfo);
  54.         else {
  55.                 $smarty->trigger_error('pnblockgetinfo: parameter [assign] required for full blockinfo');
  56.         }
  57.     }
  58.  
  59.     return;
  60. }

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