Skip to content

Commit

Permalink
Make sure that lists come out in sorted order, and turn off template …
Browse files Browse the repository at this point in the history
…caching

when generating the packagelists; it takes more time, but with it on only
the first one gets generated.


git-svn-id: http://svn.php.net/repository/pear/packages/PHPDoc/trunk@55809 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Chuck Hagenbuch committed Aug 23, 2001
1 parent 9ad39e1 commit f215918
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
3 changes: 2 additions & 1 deletion core/Phpdoc.php
Expand Up @@ -192,6 +192,7 @@ function render($type = "html", $target = "", $template = "") {

$fileHandler = new PhpdocFileHandler;
$files = $fileHandler->getFilesInDirectory($target, "xml");
sort($files);
$len = strlen($target);

$tpl = new IntegratedTemplate($this->templateRoot);
Expand Down Expand Up @@ -237,4 +238,4 @@ function render($type = "html", $target = "", $template = "") {
} // end func render

} // end class Phpdoc
?>
?>
6 changes: 3 additions & 3 deletions filehandler/PhpdocFileHandler.php
Expand Up @@ -185,10 +185,10 @@ function getFilesInDirectory($directory, $suffix = "", $flag_subdir = true, $fil
if ("." == $file || ".." == $file)
continue;

if ($flag_subdir && is_dir($directory.$file))
if ($flag_subdir && @is_dir($directory.$file))
$files = $this->getFilesInDirectory($directory.$file, $suffix, true, $files);

if (!is_file($directory.$file))
if (!@is_file($directory.$file))
continue;

if ($flag_all) {
Expand All @@ -205,4 +205,4 @@ function getFilesInDirectory($directory, $suffix = "", $flag_subdir = true, $fil
} // end fun getFilesInDirectory

} // end class PhpdocFileHandler
?>
?>
32 changes: 18 additions & 14 deletions renderer/html/PhpdocHTMLIndexRenderer.php
Expand Up @@ -188,6 +188,7 @@ function renderElementlist($xmlfile) {
}

$chapters = $this->accessor->getChapters();
ksort($chapters);
reset($chapters);
while (list($name, $elements) = each($chapters)) {

Expand Down Expand Up @@ -283,7 +284,8 @@ function renderPackagelist($xmlfile) {

$this->loadPackagelist($xmlfile);
$this->tpl->loadTemplatefile("packagelist.html");


ksort($this->packages);
reset($this->packages);
while (list($packagename, $package) = each($this->packages)) {

Expand All @@ -292,8 +294,9 @@ function renderPackagelist($xmlfile) {
if (!isset($package[$field]))
continue;

$this->tpl->setCurrentBlock("package_".$field."_loop");
$this->tpl->setCurrentBlock("package_".$field."_loop");

sort($package[$field]);
reset($package[$field]);
while (list($k, $element) = each($package[$field])) {

Expand Down Expand Up @@ -336,33 +339,34 @@ function renderFrameElementlist($xmlfile) {
$this->loadPackagelist($xmlfile);

reset($this->packages);
$caching = $this->tpl->flagCacheTemplatefile;
$this->tpl->flagCacheTemplatefile = false;
while (list($packagename, $package) = each($this->packages)) {

$this->tpl->loadTemplatefile("frame_packageelementlist.html");
$this->tpl->loadTemplatefile('frame_packageelementlist.html');

reset($this->packageFields);
while (list($k, $field) = each($this->packageFields)) {

if (!isset($package[$field]))
if (!isset($package[$field])) {
continue;
}

$this->tpl->setCurrentBlock("package_" . $field . "_loop");

sort($package[$field]);
reset($package[$field]);
while (list($k, $element) = each($package[$field])) {

$this->tpl->setVariable("ELEMENT", sprintf('<a href="%s" target="main">%s</a>',
$this->nameToUrl($element) . $this->file_extension,
$element
)
);
$this->nameToUrl($element) . $this->file_extension,
$element
)
);
$this->tpl->parseCurrentBlock();
}

$this->tpl->setCurrentBlock("package_" . $field);
$this->tpl->setVariable("EMPTY", "");
$this->tpl->parseCurrentBlock();

}

$this->tpl->setCurrentBlock("package");
Expand All @@ -371,9 +375,9 @@ function renderFrameElementlist($xmlfile) {

$this->tpl->setVariable("APPNAME", $this->application);
$packagename = $this->nameToUrl($packagename);
$this->fileHandler->createFile($this->path . "packageelementlist_" . $packagename . $this->file_extension, $this->tpl->get() );

$this->fileHandler->createFile($this->path . "packageelementlist_" . $packagename . $this->file_extension, $this->tpl->get());
}
$this->tpl->flagCacheTemplatefile = $caching;

$this->tpl->free();

Expand Down Expand Up @@ -456,4 +460,4 @@ function buildClasstreeHTML($class) {
} // end func buildClasstreeHTML

} // end class PhpdocHTMLIndexRenderer
?>
?>

0 comments on commit f215918

Please sign in to comment.