Advertisement
Guest User

Untitled

a guest
May 6th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. class data {
  2. var $dir = 'D:wamp4wwwbegin';
  3.  
  4. public function scandir_through($dir)
  5. {
  6. $items = glob($dir . '/*');
  7. for ($i = 0; $i < count($items); $i++) {
  8. if (is_dir($items[$i])) {
  9. $add = glob($items[$i] . '/*');
  10. $items = array_merge($items, $add);
  11. }
  12. }
  13. return $items;
  14. }
  15.  
  16. public function main()
  17. {
  18. $scan_tree = $this->scandir_through($dir);
  19. echo "<ul id='booklist'>"."</n>";
  20. foreach ($scan_tree as $key=>$file){
  21. $url = $file;
  22. $xml = simplexml_load_file($url);
  23. $book_count = count($xml->book);
  24. for($i = 0; $i < $book_count; $i++) {
  25. $book = $xml->book[$i];
  26. $title=$xml->book[$i]->title;
  27. $author=$xml->book[$i]->author;
  28. //echo '</br>';
  29. //echo $file. " &nbsp ";
  30. //echo $title. " &nbsp ";
  31. //echo $author;
  32. echo "<li><div class='file'>".$file."</div>
  33. <div class='title'>".$title."</div>
  34. <div class='author'>".$author."</div></li></n>";
  35. }
  36. }
  37. echo "</ul>";
  38. }
  39. }
  40. $d = new data();
  41. $d->main();
  42. ?>
  43.  
  44. $scan_tree = $this->scandir_through($this->dir);
  45.  
  46. public function main()
  47.  
  48. public function main($dir)
  49.  
  50. $d->main($dir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement