24 static $counters = array();
26 $name = (isset($params[
'name'])) ? $params[
'name'] :
'default';
27 if (!isset($counters[$name])) {
28 $counters[$name] = array(
35 $counter =& $counters[$name];
37 if (isset($params[
'start'])) {
38 $counter[
'start'] = $counter[
'count'] = (int)$params[
'start'];
41 if (!empty($params[
'assign'])) {
42 $counter[
'assign'] = $params[
'assign'];
45 if (isset($counter[
'assign'])) {
46 $template->assign($counter[
'assign'], $counter[
'count']);
49 if (isset($params[
'print'])) {
50 $print = (bool)$params[
'print'];
52 $print = empty($counter[
'assign']);
56 $retval = $counter[
'count'];
61 if (isset($params[
'skip'])) {
62 $counter[
'skip'] = $params[
'skip'];
65 if (isset($params[
'direction'])) {
66 $counter[
'direction'] = $params[
'direction'];
69 if ($counter[
'direction'] ==
"down")
70 $counter[
'count'] -= $counter[
'skip'];
72 $counter[
'count'] += $counter[
'skip'];
smarty_function_counter($params, $template)
Smarty {counter} function plugin.