[phplib] Re: Blocks in template class From: Ninjaman (ninjaman <email protected>)
Date: 04/27/01

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

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>