Mailinglisten-Archive |
hi alle,
bin nun an ITX hängen geblieben.
warum z.b. funktioniert folgender code nicht wie erwartet.
#######################################################
<?php
include_once ("HTML/ITX.php");
$tpl = new IntegratedTemplateExtension("templates/");
$tpl->loadTemplatefile("index.tpl.html");
//my block
$tpl->addBlockfile("test","meinBlock","block.tpl.html");
$tpl->setCurrentBlock("meinBlock");
for($i=1; $i<4;++$i){
$tpl->setVariable(array("id"=>$i));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("TITLE","das ist ein Test");
$tpl->setVariable("CONTENT","Das hier ist der Content");
$tpl->show();
?>
--
Blocks with IT[X] (version that didn't work because of setTemplate();)
---
<?php
include_once ("HTML/ITX.php");
$tpl = new IntegratedTemplateExtension("templates/");
$tpl->setTemplate("index.tpl.html");
//my block
$tpl->addBlockfile("test","meinBlock","block.tpl.html");
$tpl->setCurrentBlock("meinBlock");
for($i=1; $i<4;++$i){
$tpl->setVariable(array("id"=>$i));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("TITLE","das ist ein Test");
$tpl->setVariable("CONTENT","Das hier ist der Content");
$tpl->show();
?>
-----------
my templates look like this:
--
#index.tpl.html#
<html><head><title>{TITLE}</title></head>
<body>
my Title: {TITLE}<br>
{CONTENT}<br>
block begins:<br>----<br>
{test}
<br>----<br>block ends
</body>
</html>
--
#block.tpl.html#
<!--BEGIN meinBlock-->
das ist die id: {id}<br>
<!--END meinBlock-->
#######################################################
Fehlermeldung:
IntegratedTemplate Error: The variable placeholder 'test' must be unique,
found in multiple blocks ''.
georg
php::bar PHP Wiki - Listenarchive