Author Topic: Two loops in one while() cycle  (Read 705 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
Two loops in one while() cycle
on: Wed, 11. December 2002 - 15:16:09
How can I fill two TMPL_LOOP's with some values in one cycle?
My source code is:
Code: [Select]

$vtmpl-newLoopMONTH_FROM;

$vtmpl-newLoopMONTH_TO;

while $curr_month=each$months

    $vtmpl-addRow

      array

        MONTH_NUM=$curr_monthkey,

        MONTH_NAME=$curr_monthvalue

      , MONTH_FROM;

    $vtmpl-addRow

      array

        MONTH_NUM=$curr_monthkey,      

        MONTH_NAME=$curr_monthvalue

      , MONTH_TO;



$vtmpl-addLoopMONTH_FROM;

$vtmpl-addLoopMONTH_TO;



And my template is:
Code: [Select]

select name=mf

TMPL_LOOP NAME=MONTH_FROM

    option value=TMPL_VAR NAME=MONTH_NUMTMPL_IF NAME=SELECTED SELECTED/TMPL_IFTMPL_VAR NAME=MONTH_NAME

/TMPL_LOOP

/select

...

select name=mt

TMPL_LOOP NAME=MONTH_TO

    option value=TMPL_VAR NAME=MONTH_NUMTMPL_IF NAME=SELECTED SELECTED/TMPL_IFTMPL_VAR NAME=MONTH_NAME

/TMPL_LOOP

/select



But only second loop is filled. If I change the order of newLoop appearance (MONTH_TO, then MONTH_FROM), first one is filled, second is not.
Seems like addRow(rowdata, loopname) pays no attention to "loopname" parameter.
Am I right?

releasedj

  • Guest
Two loops in one while() cycle
Reply #1 on: Wed, 11. December 2002 - 19:46:33
This is a bug in version 3.0.10 and below.

Please download the latest version.

vLIB is now hosted on Sourceforge.net. To get to the download page, simply click "Downloads->Latest Downloads" from the navigation.


Regards,

Kelvin
PS: I've tested the functionality that you wrote down with the new version 4.0.0 and it works.

Guest

  • Guest
Two loops in one while() cycle
Reply #2 on: Sun, 15. December 2002 - 08:59:09
Sorry for too late replying, we had some offline holydays here. -) I'll try the latest version.
And thanks for your vlib effort! -)