10 * Smarty {counter} function plugin
14 * Purpose: print out a counter value
15 * @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
16 * (Smarty online manual)
17 * @param array parameters
21 function smarty_function_counter($params, &$smarty)
23 static $counters = array();
35 if (!isset($counters[$name])) {
36 $counters[$name] = array(
43 $counter =& $counters[$name];
46 $counter['start'] = $counter['count'] = $start;
49 if (!empty($assign)) {
50 $counter['assign'] = $assign;
53 if (isset($counter['assign'])) {
54 $smarty->assign($counter['assign'], $counter['count']);
58 $print = (bool)$print;
60 $print = empty($counter['assign']);
64 $retval = $counter['count'];
70 $counter['skip'] = $skip;
73 if (isset($direction)) {
74 $counter['direction'] = $direction;
77 if ($counter['direction'] == "down")
78 $counter['count'] -= $counter['skip'];
80 $counter['count'] +
= $counter['skip'];
86 /* vim: set expandtab: */
This page took 0.737362 seconds and 4 git commands to generate.