ITX addBlock (Bug?)
| From: | iwanbirrer at bluewin dot ch | Date: | Wed, 26 Jun 2002 08:57:01 +0000 |
| Subject: | ITX addBlock (Bug?) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1764@lists.php.net to get a copy of this message | ||
Hello,
I have some Problems using addBlock (in parsed blocks) in the IT Template
System.
I think the easiest way to explain my problem, is an example:
This is the Template File I use: *****************************
<html>
<body>
<p>Start Main Block</p>
{MAIN_BLOCK}
<!-- BEGIN main_block -->
<p>Start Inner Block</p>
<!-- BEGIN inner_block -->
{INNER_BLOCK}
<!-- END inner_block -->
<p>End Inner Block</p>
<!-- END main_block -->
<p>End Main Block</p>
</body>
</html>
And this is the php File: *********************************
require_once("HTML/IT.php");
require_once("HTML/ITX.php");
$tpl = new IntegratedTemplateExtension( "./" );
$tpl->loadTemplatefile("itxTest.htm", true, true);
$tpl->setCurrentBlock("main_block");
$tpl->setVariable("MAIN_BLOCK", "A var outside the inner block");
$tpl->setCurrentBlock("inner_block");
$tpl->addBlock("INNER_BLOCK", "inner_block1", "Inner Template
{TEMP_VAR1}");
$tpl->setCurrentBlock("inner_block1");
$tpl->setVariable("TEMP_VAR1", "Temp Var 1");
// Parse inner_block1
$tpl->parseCurrentBlock();
// Parse inner_block
$tpl->setCurrentBlock("inner_block");
$tpl->parseCurrentBlock();
$tpl->addBlock("INNER_BLOCK", "inner_block2", "Inner Template
{TEMP_VAR2}<br>");
$tpl->setCurrentBlock("inner_block2");
$tpl->setVariable("TEMP_VAR2", "Temp Var 2");
// Parse inner_block2
$tpl->parseCurrentBlock();
// Parse inner_block
$tpl->setCurrentBlock("inner_block");
$tpl->parseCurrentBlock();
// Parse Main Block
$tpl->setCurrentBlock("main_block");
$tpl->parseCurrentBlock();
$tpl->show()
The Output looks like this: ***************************
Start Main Block
A var outside the inner block
Start Inner Block
Inner Template Temp Var 1
End Inner Block
End Main Block
But I would expect: ***************************
Start Main Block
A var outside the inner block
Start Inner Block
Inner Template Temp Var 1
Inner Template Temp Var 2
End Inner Block
End Main Block
*******************************
Hopefully somebody can help!
Thanks
Iwan