Re: Blocks in template class
| From: | Ninjaman | Date: | Fri, 27 Apr 2001 13:31:01 +0000 |
| Subject: | Re: Blocks in template class | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-2922@lists.php.net to get a copy of this message | ||
I have narrowed the problem down to the following puzzling fact.
The problem is that I can't get anything back into the block.
The following doesn't work:
// Create the block handle
$tpl->set_block("theList", "myblock", "HANDLE");
// Make the list
$tpl->set_var("BLOCK_ROW", "One");
$tpl->parse("HANDLE", "myblock", true);
//and more items...
This just prints the word HANDLE where the list is is supposed to be.
What does work is this:
// Create the block handle
$tpl->set_block("theList", "myblock", "{HANDLE}");
// Make the list
$tpl->set_var("BLOCK_ROW", "One");
$tpl->parse("HANDLE", "myblock", true);
//more items...
Note the difference. HANDLE in set_block is replaced by {HANDLE}. With this
code everything prints nicely.
I have checked the source of template.inc and indeed looks right.
(Row 109) $str = preg_replace($reg, "{$name}", $str);
I don't get it! Why is this? Everybody writing examples and using
template.inc seem to have no problem.
/NinjaMan