Example of 'strange' IT/ITX behaviour

From: Date: Mon, 11 Feb 2002 13:41:02 +0000
Subject: Example of 'strange' IT/ITX behaviour
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-826@lists.php.net to get a copy of this message
Hi I have attached ( i hope ) what IMHO demostrates a strange behaviour of IT/ITX, please correct me if I'm wrong as I would realy like to use PEAR Steen

<?php require_once("HTML/ITX.php"); $tpl = new IntegratedTemplateExtension(); $tpl->loadTemplatefile("test_template.html"); $tpl->touchBlock("STATIC"); // $tpl->parseCurrentBlock(); // If you uncomment the above line, you only get that block as output ! $tpl_result = $tpl->addBlockfile("ROW_DATA","ROW_DATA_BLOCK","test_template_row.html"); if(PEAR::IsError($tpl_result)) die ($tpl_result->getMessage()); $array_test = array("ARRAY_1" => "element 1","ARRAY_2" => "element 2"); for($i = 0; $i < 3; $i++) { $tpl->setCurrentblock("HEADER"); $tpl->setVariable("HEADER_TEXT", "Header $i"); $tpl->setVariable($array_test); $tpl->parseCurrentBlock(); // Now some text between header and lines - at least the intention $tpl->setCurrentblock("STATIC"); $tpl->touchBlock("STATIC"); $tpl->parseCurrentBlock(); for($j = 0; $j < 3; $j++) { $tpl->setCurrentBlock("ROW_DATA_BLOCK"); $a = array( "ROW_TEXT_1" => "Header $i, row $j", "ROW_TEXT_2" => "Header $i, row $j", "ROW_TEXT_3" => "Header $i, row $j", "ROW_TEXT_4" => "Header $i, row $j", "ROW_TEXT_5" => "Header $i, row $j"); $tpl->setVariable($a); $tpl->setVariable($array_test); $tpl->parseCurrentblock(); } $tpl->parse("MAIN"); // This line is VERY important !! } $tpl->show(); ?>
« previous php.pear.general (#826) next »