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

Source for file block.bitmodule.php

Documentation is available at block.bitmodule.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7. // $Header$
  8. /**
  9.  * \brief Smarty {bitmodule}{/bitmodule} block handler
  10.  *
  11.  * To make a module it is enough to place smth like following
  12.  * into corresponding mod-name.tpl file:
  13.  * \code
  14.  *  {bitmodule name="module_name" title="Module title"}
  15.  *    <!-- module Smarty/HTML code here -->
  16.  *  {/bitmodule}
  17.  * \endcode
  18.  *
  19.  * This block may (can) use 2 Smarty templates:
  20.  *  1) module.tpl = usual template to generate module look-n-feel
  21.  *  2) module-error.tpl = to generate diagnostic error message about
  22.  *     incorrect {bitmodule} parameters
  23.  
  24. \Note
  25. error was used only in case the name was not there.
  26. I fixed that error case. -- mose
  27.  
  28.  */
  29. function smarty_block_bitmodule$pParams$pContent&$gBitSmarty{
  30.     ifempty$pContent )) {
  31.         return '';
  32.     else {
  33.         $pParams['data'$pContent;
  34.     }
  35.  
  36. //    if( empty( $pParams['title'] )) {
  37. //        $pParams['title'] = substr( $pContent, 0, 12 )."&hellip;";
  38. //    }
  39.  
  40. //    if( empty( $pParams['name'] )) {
  41. //        $pParams['name'] = preg_replace( "/[^-_a-zA-Z0-9]/", "", $pParams['title'] );
  42. //    }
  43.  
  44.     // this is outdated and will not work with our serialised cookies - xing
  45.     /*
  46.     if( $_COOKIE[$name] == 'c' ) {
  47.         $pParams['toggle_state'] = 'none';
  48.     } else {
  49.         $pParams['toggle_state'] = 'block';
  50.     }
  51.      */
  52.     
  53.     $pParams['name'preg_replace"/[^a-zA-Z0-9\\-\\_]/"""$pParams['name');
  54.     
  55.     $gBitSmarty->assign'modInfo'$pParams );
  56.     return $gBitSmarty->fetch('bitpackage:themes/module.tpl');
  57. }
  58. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:11 +0000 by phpDocumentor 1.5.0-lsces