Older Newer
Fri, 22 Aug 2003 11:15:42 . . . .

Changes by last author:

=== String Repeat ===

Author: Ken Stanley <smarty@kennethpaul.com>

This plugin gives you the same results as the native PHP function str_repeat does. There

are three attributes to the function: STRING (String to repeat) and COUNT (How many times to repeat) and ASSIGN which allows you to stuff the results into a template variable to use

as many times throughout the template as you wish.




* Smarty plugin

* -------------

* Type: function

* Name: str_repeat

* Author: Ken Stanley <smarty@kennethpaul.com>

* Purpose: print out a value x amount of times

* -------------


function smarty_function_str_repeat($params, &$smarty)


static $string = array();

static $count = array();

static $assign = "";


if (!empty($assign))

$smarty->assign($assign, str_repeat($string[0],$count[0]));


echo str_repeat($string[0],$count[0]);




Back to SmartyPlugins?.