Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class data {
- var $dir = 'D:wamp4wwwbegin';
- public function scandir_through($dir)
- {
- $items = glob($dir . '/*');
- for ($i = 0; $i < count($items); $i++) {
- if (is_dir($items[$i])) {
- $add = glob($items[$i] . '/*');
- $items = array_merge($items, $add);
- }
- }
- return $items;
- }
- public function main()
- {
- $scan_tree = $this->scandir_through($dir);
- echo "<ul id='booklist'>"."</n>";
- foreach ($scan_tree as $key=>$file){
- $url = $file;
- $xml = simplexml_load_file($url);
- $book_count = count($xml->book);
- for($i = 0; $i < $book_count; $i++) {
- $book = $xml->book[$i];
- $title=$xml->book[$i]->title;
- $author=$xml->book[$i]->author;
- //echo '</br>';
- //echo $file. "   ";
- //echo $title. "   ";
- //echo $author;
- echo "<li><div class='file'>".$file."</div>
- <div class='title'>".$title."</div>
- <div class='author'>".$author."</div></li></n>";
- }
- }
- echo "</ul>";
- }
- }
- $d = new data();
- $d->main();
- ?>
- $scan_tree = $this->scandir_through($this->dir);
- public function main()
- public function main($dir)
- $d->main($dir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement