Hi all,
I've got some kind of problem. I've the following PHP code:
$tpl = new FastTemplate($es_root_path.'templates/'.strtolower(htmlentities($Template)));
$start = $tpl->utime();
$tpl->define(
array(
header => "overall_header.tpl",
index_body => "index_body.tpl",
menu => "menu.tpl",
footer => "overall_footer.tpl",
)
);
$tpl->define_dynamic ( "options", menu );
for ($n=1; $n <= 3; $n++)
{
$tpl->define_dynamic ( "option_header", menu );
if($n != 1) {
$tpl->clear_dynamic("option_header");
}
$tpl->assign(
array(
NAV => 'optie '.$n,
NAV_MOUSE => addslashes(htmlentities('S')),
NAV_HREF => 'index.php',
)
);
$tpl->parse(OPTION,".menu");
$tpl->define_dynamic ( "option_footer", menu );
if($n != 3) {
$tpl->clear_dynamic("option_footer");
}
}
$tpl->assign(
array(
TITLE => $Title,
LANGUAGE => strtolower(htmlentities($Language)),
HEADER => $header,
TICKER => ticker($Lang['SLOGAN']),
USER_CP => $UserCp,
COPYRIGHT => copyright()
)
);
$tpl->parse(MAIN, array("menu", "index_body", "header", "footer"));
$run = $tpl->utime() - $start;
echo 'Loading time: '.round($run,4).' sec';
$tpl->FastPrint();
with menu.TPL:
<!-- START: menu.tpl -->
<!-- BEGIN DYNAMIC BLOCK: option_header -->
<table width="180" border="0" cellpadding="0" cellspacing="0" class="mousemenu">
<!-- END DYNAMIC BLOCK: option_header -->
<!-- BEGIN DYNAMIC BLOCK: options -->
<tr>
<td width="2" height="16"></td>
<td width="178" class="menuoption">{NAV}</td>
</tr>
<!-- END DYNAMIC BLOCK: options -->
<!-- BEGIN DYNAMIC BLOCK: option_footer -->
</table>
<!-- END DYNAMIC BLOCK: option_footer -->
<!-- END: menu.tpl -->
Now, the problem is the "for" loop. It seems like fasttemplate cannot handle the if($n != 1) and if($n != 3), because the </table> (option_footer) isn't shown anywhere, while the option_header is shown well. If I change the 1 and 3 in 3 and 1, it is just the other way. Strange, but I need a sollution.
Anybody?
Thanks, if necesarry, I'll give some more details.