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

Source for file function.pnblockshow.php

Documentation is available at function.pnblockshow.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.pnblockshow.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 show a zikula block by blockinfo array or blockid.
  15.  *
  16.  * This function returns a zikula block by blockinfo array or blockid
  17.  *
  18.  * Available parameters:
  19.  *   - module
  20.  *   - blockname
  21.  *   - block
  22.  *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  23.  *
  24.  *
  25.  * @author       Sebastian Schürmann
  26.  * @since        14.10.2003
  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 zikula block
  30.  */
  31. function smarty_function_pnblockshow($params&$smarty)
  32. {
  33.     $module    = isset($params['module'])    $params['module']    null;
  34.     $blockname = isset($params['blockname']$params['blockname'null;
  35.     $block     = isset($params['block'])     $params['block']     null;
  36.     $assign    = isset($params['assign'])    $params['assign']    null;
  37.  
  38.     if (!$module{
  39.         $smarty->trigger_error("pnblockshow: parameter [module] is required");
  40.         return;
  41.     }
  42.  
  43.     if (!$blockname{
  44.         $smarty->trigger_error("pnblockshow: parameter [blockname] is required");
  45.         return;
  46.     }
  47.  
  48.     if (!$block{
  49.         $smarty->trigger_error("pnblockshow: parameter [block information or id] is required");
  50.         return;
  51.     }
  52.  
  53.     if (!is_array($block)) {
  54.         $output pnBlockShow($module$blocknamepnBlockGetInfo($block));
  55.     else {
  56.         $vars   pnBlockVarsFromContent($block['content']);
  57.         $output pnBlockShow($module$blockname$vars['content']);
  58.     }
  59.  
  60.     if ($assign{
  61.         $smarty->assign($assign$output);
  62.     else {
  63.         return $output;
  64.     }
  65. }

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