48 $name = (empty($params[
'name'])) ?
'default' : $params[
'name'];
49 $print = (isset($params[
'print'])) ? (
bool)$params[
'print'] :
true;
50 $advance = (isset($params[
'advance'])) ? (
bool)$params[
'advance'] :
true;
51 $reset = (isset($params[
'reset'])) ? (
bool)$params[
'reset'] :
false;
53 if (!in_array(
'values', array_keys($params))) {
54 if(!isset($cycle_vars[$name][
'values'])) {
55 $smarty->trigger_error(
"cycle: missing 'values' parameter");
59 if(isset($cycle_vars[$name][
'values'])
60 && $cycle_vars[$name][
'values'] != $params[
'values'] ) {
61 $cycle_vars[$name][
'index'] = 0;
63 $cycle_vars[$name][
'values'] = $params[
'values'];
66 if (isset($params[
'delimiter'])) {
67 $cycle_vars[$name][
'delimiter'] = $params[
'delimiter'];
68 } elseif (!isset($cycle_vars[$name][
'delimiter'])) {
69 $cycle_vars[$name][
'delimiter'] =
',';
72 if(is_array($cycle_vars[$name][
'values'])) {
73 $cycle_array = $cycle_vars[$name][
'values'];
75 $cycle_array = explode($cycle_vars[$name][
'delimiter'],$cycle_vars[$name][
'values']);
78 if(!isset($cycle_vars[$name][
'index']) || $reset ) {
79 $cycle_vars[$name][
'index'] = 0;
82 if (isset($params[
'assign'])) {
84 $smarty->assign($params[
'assign'], $cycle_array[$cycle_vars[$name][
'index']]);
88 $retval = $cycle_array[$cycle_vars[$name][
'index']];
94 if ( $cycle_vars[$name][
'index'] >= count($cycle_array) -1 ) {
95 $cycle_vars[$name][
'index'] = 0;
97 $cycle_vars[$name][
'index']++;