I have a problem with a example using replaceBlock() function.
This following code dont run and i dont know why, i try in a lot of way ... but nothing
Someone can help me building a correct example using the replaceBlock function?
- Code: Select all
<?php
require_once "HTML/Template/ITX.php";
$msg = "numero 1";
$a = 3;
$template = new HTML_Template_ITX("templates");
$template->loadTemplatefile("about_today1.tpl", true, true);
print $a;
print "<br>";
if ($a > 2)
$template->replaceBlock("PROVA", "about_today3.tpl", true);
$template->setCurrentBlock("PROVA");
$template->setVariable("MESSAGE", $msg);
$template->parseCurrentBlock();
$template->show();
?>
about_today1.tpl :
- Code: Select all
<html>
<hrad>
<title>About today</title>
</head>
<body>
<!-- BEGIN PROVA -->
{MESSAGE}
<!-- END PROVA -->
</body>
</html>
about_today3.tpl :
- Code: Select all
Sono3: {MESSAGE}
... the condition if ($a > 2) is true, but the block in not replaced correctly and the page is blank
maybe i use not corrctle the function, but i try again in a lot way.
Thank you.

