Re: [phplib] IT[X] example From: Bertrand Mansion (bmansion <email protected>)
Date: 07/29/01

le 28/07/01 20:34, Iwan Birrer à iwanbirrer <email protected> a écrit :

> Hello,
>
> Thanks a lot for your answer, but I am not really able to get it to work.
>
> I have the followeing code:
>
> $tpl = new IntegratedTemplateExtension("templates/");
> $tpl->loadTemplatefile("page.inc.htm", true, true);
> $tpl->addBlockfile( "CONTENTS", "block_contents", "content.inc.htm");
> $tpl->setCurrentBlock("block_contents");
> $tpl->parseCurrentBlock();
>
> for($i0 = 0; $i0 <= 5; ++$i0 )
> {
> for( $i1 = 0; $i1 < 4; ++$i1 )
> {
> $a_Tpl->setCurrentBlock("inner_block");
> $a_Tpl->setVariable( "VAR1", "test1" );
> $a_Tpl->setVariable( "VAR2", "test2" );
> $a_Tpl->parseCurrentBlock();
> }
> $a_Tpl->setCurrentBlock("outer_block");
> $a_Tpl->setVariable( "VAR1", "test1" );
> $a_Tpl->setVariable( "VAR2", "test2" );
> $a_Tpl->parseCurrentBlock();
> }
> $tpl->show();
>
> And there are two templates, the page.inc.htm (With two blocks inner_block,
> outer_block and the variable {CONTENTS}) and content.inc.htm (with the block
> block_contents)
>
> If I do that I have the following error:
> Warning: Invalid argument supplied for foreach() in IT.php on line 424
>
> The inner and outer block are parsed like they should be, but where the
> {CONTENTS} Variable was, there is nothing...
>
> Would be great if somebody could help me !
>
> Thanks
>
> Iwan
>
Iwan,

I can probably help but you will have to send me directly your templates so
I can see where the problem is.

By the way, I don't see the use to do :
> $tpl->addBlockfile( "CONTENTS", "block_contents", "content.inc.htm");
> $tpl->setCurrentBlock("block_contents");
> $tpl->parseCurrentBlock();

I am waiting for your reply.

Bertrand

-- 
Abbestellen mit Mail an:   phplib-unsubscribe <email protected>
Kommandoliste mit Mail an: phplib-help <email protected>