Author Topic: addRow bug?  (Read 694 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
addRow bug?
on: Sun, 15. December 2002 - 16:52:26
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.

Code: [Select]

$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:
Code: [Select]

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:
Code: [Select]

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?).

releasedj

  • Guest
addRow bug?
Reply #1 on: Mon, 16. December 2002 - 11:24:23
Yes this is a bug.
This has been fixed in CVS.

Thanks for this report, and it's fine to report any bugs in either the forum or the bug report system at sourceforge.net .


Kind regards,

Kelvin