[phplib] Template class (dynamic blocks) From: Ilya Khandamirov (ilya <email protected>)
Date: 06/19/01

Hi,

When using Template class with dynamic block functionality, PHPLIB (7.2b)
does not output blocks: Instead of repeating blocks it outputs only name of
the block handle. It is very easy to reproduce the problem just by
copying/pasting sample code from
http://phplib.netuse.de/documentation/documentation-4.html#ss4.2.

It would be also very kind of you if you could take a look at my code
(shorter):

Template:
<!-- start page.inc.html -->
<b>{PLACEHOLDER}</b>
<ul>
<!-- BEGIN block -->
        <li> {BLOCK_PLACEHOLDER}
<!-- END block -->
</ul>

PHP code:
<?
        include("phplib/template.inc");
        $tpl = new Template();
        $tpl->set_file("page", "page.inc.html");
        $tpl->set_block("page", "block", "rows");
        $tpl->set_var("PLACEHOLDER", "Just a text.");
        for($i=0; $i<3; $i++)
        {
                $tpl->set_var("BLOCK_PLACEHOLDER", "Loop $i");
                $tpl->parse("rows", "block", true);
        }
        $tpl->parse("out", "page");
        $tpl->p("out");
?>

Output:
<!-- start page.inc.html -->
<b>Just a text.</b>
<ul>
rows
</ul>

Regards,
Ilya

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