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

Source for file block.repeat.php

Documentation is available at block.repeat.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * Smarty plugin
  10.  * -------------------------------------------------------------
  11.  * File: block.repeat.php
  12.  * Type: block
  13.  * Name: repeat
  14.  * Purpose: repeat a template block a given number of times
  15.  * Parameters: count [required] - number of times to repeat
  16.  * assign [optional] - variable to collect output
  17.  * Author: Scott Matthewman <scott@matthewman.net>
  18.  * -------------------------------------------------------------
  19.  */
  20. function smarty_block_repeat$params$content&$gBitSmarty {
  21.     if!empty$content ) ) {
  22.         $intCount intval$params['count');
  23.         if$intCount {
  24.             $gBitSmarty->trigger_error"block: negative 'count' parameter" );
  25.             return;
  26.         }
  27.  
  28.         $strRepeat str_repeat$content$intCount );
  29.         if!empty$params['assign') ) {
  30.             $gBitSmarty->assign($params['assign']$strRepeat );
  31.         else {
  32.             echo $strRepeat;
  33.         }
  34.     }
  35. }
  36. ?>

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