Problem with IT[X], block containing blocks
| From: | Franz Alt | Date: | Wed, 27 Nov 2002 17:39:58 +0000 |
| Subject: | Problem with IT[X], block containing blocks | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2862@lists.php.net to get a copy of this message | ||
I want to create a XML - File with the IT[X] Template at the end of this
mail.
Can I "put a block into another block"? Like HTML-Tags can contain other
Tags.
My PHP-Script creates a file, but only with one "<page>" instead of three
Can anybody help me?
Greetings,
Franz
Here my PHP code:
$tpl = new IntegratedTemplate("../templates");
$tpl->loadTemplatefile("template.xml", true, true);
$tpl->setVariable("TITLE", $projekt["Titel"]) ;
$tpl->setVariable("AUTHOR", $projekt["Autor"]) ;
$tpl->setCurrentBlock("page") ;
$tpl->setVariable("HEADING", $page["Ueberschrift"]) ;
$tpl->setVariable("FOLIE", $page["Beschreibung"]) ;
while (Images in Page) {
$tpl->setCurrentBlock("graphic");
$tpl->setVariable("FILE", $bild[$Nr]["FILE"]);
$tpl->setVariable("GTEXT", $bild[$Nr++]["GTEXT"]);
$tpl->parseCurrentBlock("graphic");
} // \Images
$tpl->setCurrentBlock("linkliste");
while (Hyperlinks) {
$tpl->setCurrentBlock("link");
$tpl->setVariable("TARGET", $linkmed[$Nr]["TARGET"]);
$tpl->setVariable("LINKNAME", $linkmed[$Nr]["LINKNAME"]);
$tpl->setVariable("LINKTEXT", $linkmed[$Nr++]["LINKTEXT"]);
$tpl->parseCurrentBlock("link");
}
$tpl->parseCurrentBlock("linkliste");
// close <page>
parseCurrentBlock("page");
}
// Komplettes Dokument parsen ...
$tpl->parse();
$tpl->show();
...
XML-Code
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//Torsten Bronger//DTD tbook 1.3//EN"
"/C:/Programme/tbook/tbook.dtd">
<article xml:lang="de-DE-1901">
<title>{TITLE}</title>
<author>Autor: {AUTHOR}</author>
<!-- BEGIN page -->
<section>
<heading>{HEADING}</heading>
<p>{FOLIE}</p>
<!-- BEGIN graphic -->
<figure style="clear: both">
<graphics file="{FILE}" kind="bitmap" />
<caption>{GTEXT}</caption>
</figure>
<latex code="\newline" />
<!-- END graphic -->
<!-- BEGIN linkliste -->
<p>Verknüpfte Medien:</p>
<!-- BEGIN link -->
<url name="{TARGET}">{LINKNAME}</url>
<p>{LINKTEXT}</p>
<latex code="\newline" />
<!-- END link -->
<latex code="\newpage" desperate="true"/>
<!-- END linkliste -->
</section>
<!-- END page -->
</article>