Hello,
I met a problem with the nested loop in vlib 4.0. I resolved it partially but I would wish to have confirmation.
The template :
TMPL_LOOP NAME=block1
TMPL_LOOP NAME=block2
TMPL_VAR NAME=variable_1br
TMPL_VAR NAME=variable_2br
/TMPL_LOOP
/TMPL_LOOP
First attempt :
$tmpl-newLoop'block1';
for$i=1;$i=$arguments'number_of_loops_block_1';$i++
$tmpl-newLoop'block2';
for$j=1;$j=$arguments'number_of_loops_block_2';$j++
for$k=1;$k=$arguments'number_of_variables';$k++
$data'variable_'.$k = $k;
$tmpl-addRow$data, 'block2';
$tmpl-addLoop'block2';
$tmpl-addLoop'block1';
A warning occur with the message "called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name." on the second addLoop.
Second attemp :
$data = array;
for$i=0;$i$arguments'number_of_loops_block_1';$i++
$data$i'block2' = array;
for$j=0;$j$arguments'number_of_loops_block_2';$j++
for$k=1;$k=$arguments'number_of_variables';$k++
$data$i'block2'$j'variable_'.$k = $k;
$tmpl-setLoop'block1', $data;
It's ok .
third attempt :
$tmpl-newLoop'block1';
for$i=1;$i=$arguments'number_of_loops_block_1';$i++
for$j=1;$j=$arguments'number_of_loops_block_2';$j++
for$k=1;$k=$arguments'number_of_variables';$k++
$data'block2'$j'variable_'.$k = $k;
$tmpl-addRow$data, 'block1';
$tmpl-addLoop'block1';
It's ok.
Question :
As in the first attempt, the third mode for loop (newLoop, addRow, addLoop) is useful with nested loops ?
Best regards,
Manu