RE: [PEAR] ITX addBlock (Bug?)
| From: | iwanbirrer at bluewin dot ch | Date: | Wed, 26 Jun 2002 14:09:18 +0000 |
| Subject: | RE: [PEAR] ITX addBlock (Bug?) | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1767@lists.php.net to get a copy of this message | ||
Hello,
I solved the problem (at least it works for me..), but I had to change the
addBlock() function.
If somebody is interested, this is what i have done:
removed this line:
$this->deleteFromBlockvariablelist($parents[0], $placeholder);
changed the following line:
$this->blocklist[$parents[0]] = preg_replace('@' . $this->openingDelimiter
. $placeholder . $this->closingDelimiter . '@',
$this->openingDelimiter . '__' . $blockname . '__' .
$this->closingDelimiter,
$this->blocklist[$parents[0]]
);
To this:
$this->blocklist[$parents[0]] = preg_replace('@' . $this->openingDelimiter
. $placeholder . $this->closingDelimiter . '@',
$this->openingDelimiter . '__' . $blockname . '__' .
$this->closingDelimiter
.
"\n" . $this->openingDelimiter . $placeholder . $this->closingDelimiter,
$this->blocklist[$parents[0]]
);
Iwan
>-- Original-Nachricht --
>Date: Wed, 26 Jun 2002 10:57:01 +0200
>From: iwanbirrer@bluewin.ch
>To: pear-general@lists.php.net
>Subject: [PEAR] ITX addBlock (Bug?)
>
>
>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
>
>
>
>
>
>--
>PEAR General Mailing List (http://pear.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>