Advertisement
sebbu

TABLE parser with class

Feb 26th, 2016
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>test HTML > TABLE</title>
  5. <style type="text/css">
  6. TABLE
  7. {
  8.     border: 1px black solid;
  9.     border-collapse: collapse;
  10. }
  11. TR
  12. {
  13.     height: 32px;
  14. }
  15. TD
  16. {
  17.     width: 32px;
  18.     text-align: center;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23.  
  24. <?php
  25. require('table-parser.php');
  26.  
  27. $data=file_get_contents('input.html');
  28.  
  29. $table = new table_parser($data);
  30.  
  31. $arr = $table->parse();
  32.  
  33. //var_dump($arr);
  34.  
  35. echo '<table border="1">'."\r\n";
  36. foreach($arr as $line)
  37. {
  38.     echo "\t".'<tr>'."\r\n";
  39.     foreach($line as $cell)
  40.     {
  41.         echo "\t\t".'<td>'.$cell.'</td>'."\r\n";
  42.     }
  43.     echo "\t".'</tr>'."\r\n";
  44. }
  45. echo '</table>'."\r\n";
  46. ?>
  47.  
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement