Problem in template module on sub blocks
Brought to you by:
nhruby,
richardarcher
Good morning,
I have a problem with the template module.
This is the template
<table style="padding:2px;">
<tr class="table_row " style=" text-align: left; vertical-align: top;">
<!-- BEGIN testata -->
<th class="table_cell " style=" text-align: left; "><b>{_campo_testata}</b></th>
<!-- END testata -->
</tr>
<!-- BEGIN righe_articolo -->
<tr class="table_row bg{ind_b}" style=" text-align: left; vertical-align: top;">
<!-- BEGIN campo_articolo -->
<td align="{fal}" class="{_campo_id}_f">{_campo_out}</td>
<!-- END campo_articolo -->
</tr>
<!-- END righe_articolo -->
</table>
This is the code
$tx1 = new Template($path, "remove");
$tx1->set_file(array("page" => "cat_articoli_list.html"));
$tx1->set_block("page", "testata", "campi");
$tx1->set_block("page", "righe_articolo", "righe");
$tx1->set_block("righe_articolo", "campo_articolo", "campo");
for($i=0; $i<3; $i++)
{
$tx1->set_var(array("_campo_testata" => $i));
$tx1->parse("campi", "testata", true);
}
for($i1=0; $i1< 3; $i1++)
{
$tx1->set_var(array("ind_b" => ++$i1%2));
for($i=0; $i<3; $i++)
{
$tx1->set_var(array("fal"=>"left", "_campo_id" => $i, "_campo_out"=>$i1.".".$i));
$tx1->parse("campo", "campo_articolo", true);
}
$tx1->parse("righe", "righe_articolo", true);
}
$tx1->psubst("page");
This is the result
<table style="padding:2px;">
<tr class="table_row " style=" text-align: left; vertical-align: top;">
<th class="table_cell " style=" text-align: left; "><b>0</b></th>
<th class="table_cell " style=" text-align: left; "><b>1</b></th>
<th class="table_cell " style=" text-align: left; "><b>2</b></th>
</tr>
<tr class="table_row bg1" style=" text-align: left; vertical-align: top;">
<td align="left" class="0_f">1.0</td>
<td align="left" class="1_f">1.1</td>
<td align="left" class="2_f">1.2</td>
</tr>
<tr class="table_row bg1" style=" text-align: left; vertical-align: top;">
<td align="left" class="0_f">1.0</td>
<td align="left" class="1_f">1.1</td>
<td align="left" class="2_f">1.2</td>
<td align="left" class="0_f">3.0</td>
<td align="left" class="1_f">3.1</td>
<td align="left" class="2_f">3.2</td>
</tr>
</table>
As you see the first row does it right while the second no.
Where am I wrong?