I'm not sure it is a bug, but on our systems (PHP 4.1.2 and 4.2.1) this code does not work.
Documentation says that one can use this syntax of addRow:
addRow(array row [, loopname])
...and "loopname" parameter is optional. Inspite of it this code produces a warning and does not work as intended.
$vtmpl-newLoopMONTH_FROM;
for $i=1; $i=12; $i++
$vtmpl-addRowarray
MONTH_NUM=$i,
MONTH_NAME=$vdate-getMonthFullname2002-.sprintf%02u, $i.-01,
SELECTED=$i==datem ? 1 0
//this is the problem
;
//, MONTH_FROM;
$vtmpl-addLoopMONTH_FROM;
Warning:
vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name. in /www/portalsmi.rbc.ru/data/lib/php/vlib/vlibTemplate/error.php on line 83
As you see, I declare the loop, add some data into it (without clarifying in what loop I insert to), and finish it. The loop is not filled and a warning is throwed.
After diving into code I found this line in vlibTemplate.php:
if !$loopname $loopname = $this-_currloopnamecount$this-_currloopname-1;
In our PHP versions (4.1.2 and 4.2.1) this code snipped does not return last inserted loop name, so I wrote this:
if !$loopname $loopname=end$this-_currloopname;
Now this code returns _currloopname's last element, and addRow works well in both situation -- when loopname is defined and when it's not.
I use 4.0.0 version of your library taken from sourceforge.net, as you suggested.
P.S. Sorry if I'm writing into wrong section (should I do it in "Feedback" or somewhere else?).