/** * Renders the PHPDoc XML files as HTML files * * @param string Targetformat, currently only "html" is available. * @param string Target directory for the html files * @param string Directory with the html templates * @return bool $ok * @throws PhpdocError * @access public */ function render($type = "html", $target = "", $template = "") { $this->outl("Starting to render..."); $target = "" == $target ? $this->target : $this->getCheckedDirname($target); $template = "" == $template ? $this->templateRoot : $this->getCheckedDirname($template); switch (strtolower($type)) { case "html": default: $renderer = new PhpdocHTMLRendererManager($target, $template, $this->application, $this->targetFileSuffix); break; } $fileHandler = new PhpdocFileHandler(); $files = $fileHandler->getFilesInDirectory($target, "xml"); sort($files); $len = strlen($target); $tpl = new IntegratedTemplate($this->templateRoot); $tpl->loadTemplateFile("xmlfiles.html"); $tpl->setCurrentBlock("file_loop"); // Do not change the file prefixes! reset($files); while (list($k, $file) = each($files)) { $tpl->setVariable("FILE", substr($file, $len)); $tpl->parseCurrentBlock(); if ("class_" == substr($file, $len, 6)) { $renderer->render(substr($file, $len), "class"); } else { if ("module_" == substr($file, $len, 7)) { $renderer->render(substr($file, $len), "module"); } else { if ("classtree_" == substr($file, $len, 10)) { $renderer->render(substr($file, $len), "classtree"); } else { if ("modulegroup_" == substr($file, $len, 12)) { $renderer->render(substr($file, $len), "modulegroup"); } else { if ("warnings_" == substr($file, $len, 9)) { $renderer->render(substr($file, $len), "warning"); } } } } } } $renderer->finish(); // 3/11/2002 - Tim Gallagher added the next two lines // so the version and link could be put in and easily // changed as versions, and urls change. $tpl->setVariable("PHPDOCVERSION", PHPDOC_VERSION); $tpl->setVariable("PHPDOC_LINK", PHPDOC_LINK); $tpl->setVariable("PHPDOC_GENERATED_DATE", PHPDOC_GENERATED_DATE); $fileHandler->createFile($target . "phpdoc_xmlfiles" . $this->targetFileSuffix, $tpl->get()); $this->outl($this->finishInstructions); return true; }
<?php include 'tplutil.inc'; require_once 'HTML/IT.php'; $tpl = new IntegratedTemplate('slides/pragmatic'); $tpl->loadTemplateFile('integratedtemplate.tpl'); foreach (get_users() as $user) { $tpl->setCurrentBlock('option'); $tpl->setVariable('USER', $user); $tpl->parseCurrentBlock(); } $tpl->setVariable('TITLE', 'My Title'); $tpl->setVariable('USER', 'jimw'); $tpl->show();