cvs: smarty / NEWS /libs/plugins function.counter.php
| From: | Messju Mohr | Date: | Tue, 03 Jun 2003 13:22:41 +0000 |
| Subject: | cvs: smarty / NEWS /libs/plugins function.counter.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-621@lists.php.net to get a copy of this message | ||
messju Tue Jun 3 09:22:41 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs/plugins function.counter.php
Log:
fixed behaviour of start=... for {counter}
Index: smarty/NEWS
diff -u smarty/NEWS:1.366 smarty/NEWS:1.367
--- smarty/NEWS:1.366 Mon Jun 2 11:13:17 2003
+++ smarty/NEWS Tue Jun 3 09:22:41 2003
@@ -1,3 +1,4 @@
+ - fixed behaviour of start=... for {counter} (messju)
- fixed assign for {counter} (messju)
- added params vdir, hdir and inner to html_table to allow looping
over the data in various directions (messju)
Index: smarty/libs/plugins/function.counter.php
diff -u smarty/libs/plugins/function.counter.php:1.9 smarty/libs/plugins/function.counter.php:1.10
--- smarty/libs/plugins/function.counter.php:1.9 Mon Jun 2 11:13:18 2003
+++ smarty/libs/plugins/function.counter.php Tue Jun 3 09:22:41 2003
@@ -36,44 +36,40 @@
$counters[$name] = array(
'start'=>1,
'skip'=>1,
- 'assign'=>null,
- 'direction'=>'up'
+ 'direction'=>'up',
+ 'count'=>1
);
}
$counter =& $counters[$name];
-
- if (isset($start))
- $counter['start'] = $start;
- else if (!isset($counter['start']))
- $counter['start'] = 1;
-
- if (!isset($counter['count']))
- $counter['count'] = $counter['start'];
+ if (isset($start)) {
+ $counter['start'] = $counter['count'] = $start;
+ }
if (!empty($assign)) {
$counter['assign'] = $assign;
}
- if (!empty($counter['assign'])) {
+ if (isset($counter['assign'])) {
$smarty->assign($counter['assign'], $counter['count']);
}
- if (!isset($print))
- $print = empty($counter['assign']);
- else
+ if (isset($print)) {
$print = (bool)$print;
-
- if (isset($skip)) {
- $counter['skip'] = $skip;
+ } else {
+ $print = empty($counter['assign']);
}
-
+
if ($print) {
$retval = $counter['count'];
} else {
$retval = null;
}
+ if (isset($skip)) {
+ $counter['skip'] = $skip;
+ }
+
if (isset($direction)) {
$counter['direction'] = $direction;
}