mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
fixed behaviour of start=... for {counter}
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- fixed behaviour of start=... for {counter} (messju)
|
||||||
- fixed assign for {counter} (messju)
|
- fixed assign for {counter} (messju)
|
||||||
- added params vdir, hdir and inner to html_table to allow looping
|
- added params vdir, hdir and inner to html_table to allow looping
|
||||||
over the data in various directions (messju)
|
over the data in various directions (messju)
|
||||||
|
@@ -36,44 +36,40 @@ function smarty_function_counter($params, &$smarty)
|
|||||||
$counters[$name] = array(
|
$counters[$name] = array(
|
||||||
'start'=>1,
|
'start'=>1,
|
||||||
'skip'=>1,
|
'skip'=>1,
|
||||||
'assign'=>null,
|
'direction'=>'up',
|
||||||
'direction'=>'up'
|
'count'=>1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$counter =& $counters[$name];
|
$counter =& $counters[$name];
|
||||||
|
|
||||||
|
if (isset($start)) {
|
||||||
if (isset($start))
|
$counter['start'] = $counter['count'] = $start;
|
||||||
$counter['start'] = $start;
|
}
|
||||||
else if (!isset($counter['start']))
|
|
||||||
$counter['start'] = 1;
|
|
||||||
|
|
||||||
if (!isset($counter['count']))
|
|
||||||
$counter['count'] = $counter['start'];
|
|
||||||
|
|
||||||
if (!empty($assign)) {
|
if (!empty($assign)) {
|
||||||
$counter['assign'] = $assign;
|
$counter['assign'] = $assign;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($counter['assign'])) {
|
if (isset($counter['assign'])) {
|
||||||
$smarty->assign($counter['assign'], $counter['count']);
|
$smarty->assign($counter['assign'], $counter['count']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($print))
|
if (isset($print)) {
|
||||||
$print = empty($counter['assign']);
|
|
||||||
else
|
|
||||||
$print = (bool)$print;
|
$print = (bool)$print;
|
||||||
|
} else {
|
||||||
if (isset($skip)) {
|
$print = empty($counter['assign']);
|
||||||
$counter['skip'] = $skip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($print) {
|
if ($print) {
|
||||||
$retval = $counter['count'];
|
$retval = $counter['count'];
|
||||||
} else {
|
} else {
|
||||||
$retval = null;
|
$retval = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($skip)) {
|
||||||
|
$counter['skip'] = $skip;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($direction)) {
|
if (isset($direction)) {
|
||||||
$counter['direction'] = $direction;
|
$counter['direction'] = $direction;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user