You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
979 B

23 years ago
21 years ago
23 years ago
23 years ago
23 years ago
22 years ago
22 years ago
22 years ago
23 years ago
23 years ago
  1. <?php
  2. /** @file tree.php
  3. * @brief Program Tree view example
  4. * @ingroup Examples
  5. * @author Marcus Boerger
  6. * @date 2003 - 2005
  7. *
  8. * Usage: php tree.php \<path\>
  9. *
  10. * Simply specify the path to tree with parameter \<path\>.
  11. */
  12. // The following line only operates on classes which are converted to c already.
  13. // But does not generate a graphical output.
  14. //foreach(new RecursiveIteratorIterator(new ParentIterator(new RecursiveDirectoryIterator($argv[1])), 1) as $file) {
  15. if ($argc < 2) {
  16. echo <<<EOF
  17. Usage: php ${_SERVER['PHP_SELF']} <path>
  18. Displays a graphical tree for the given <path>.
  19. <path> The directory for which to generate the tree graph.
  20. EOF;
  21. exit(1);
  22. }
  23. if (!class_exists("DirectoryTreeIterator", false)) require_once("directorytreeiterator.inc");
  24. if (!class_exists("DirectoryGraphIterator", false)) require_once("directorygraphiterator.inc");
  25. echo $argv[1]."\n";
  26. foreach(new DirectoryGraphIterator($argv[1]) as $file)
  27. {
  28. echo $file . "\n";
  29. }
  30. ?>