I have used dynamic tables in FastTemplates with perfect success, until now!
I have 2 templates defined in 1 php program, say template A and template B :
$tpl->define(
array(
header => "main-header.tpl",
A_table => "A.tpl",
B_table => "B.tpl",
footer => "main-footer.tpl"
)
);
Both these templates contain a dynamic array:
$tpl->define_dynamic( "A_rows" , "A_table" );
$tpl->define_dynamic( "B_rows" , "B_table" );
Now I do my calls to the DB and assign the values to the dynamic rows in both tables through 2 different loops:
while....
$tpl->parse(ROWS, ".A_rows");
endwhile
while....
$tpl->parse(ROWS, ".B_rows");
endwhile
next I parse them and FastPrint:
$tpl->parse(HEAD, "header");
$tpl->parse(BODY1, "A_table");
$tpl->parse(BODY2, "B_table");
$tpl->parse(FOOT, "footer");
$tpl->FastPrint("HEAD");
$tpl->FastPrint("BODY1");
$tpl->FastPrint("BODY2");
$tpl->FastPrint("FOOT");
Now what this actually does is display the first template A.tpl, but with both tables. Then it will display template B.tpl, again with both tables. So each template is displaying both dynamic tables, even though they only contain one different one each!
BTW, I did have the 2 tables in the one template, but split them into 2 thinking it might solve this problem, but it didn't!! Any suggestions please?!!!