Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.     class Loadxml{
  3.         public function __construct($xmlFile){
  4.             $this->xmlFile = simplexml_load_file($xmlFile);
  5.            
  6.             foreach($this->xmlFile->song as $file){
  7.                 $this->sort[] = $file;
  8.             }
  9.         }
  10.        
  11.         public function display(){        
  12.             echo'<table border="1">
  13.                    <tr>
  14.                        <td>Title</td>
  15.                        <td>Artist</td>
  16.                        <td>Duration</td>
  17.                        <td>Release</td>
  18.                        <td>Category</td>';
  19.             foreach($this->sort as $new){
  20.                     echo'<tr><td>' . $new->title . '</td>
  21.                    <td>' . $new->artist . '</td>
  22.                    <td>' . $new->duration . '</td>
  23.                    <td>' . $new->release . '</td>
  24.                    <td>' . $new->category . '</td>';
  25.             }
  26.             echo'</tr></table>';
  27.         }
  28.     }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement