Advertisement
Guest User

Untitled

a guest
Nov 14th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  <head>
  3.   <title>teszt</title>
  4.   </head>
  5.  <body>
  6. <?php
  7. if(($data=@file_get_contents('test.txt'))!==FALSE){
  8.  foreach(explode(PHP_EOL,$data) as $line)if($line!=''){
  9.   unset($split);
  10.   if(count($split=explode(';',$line))>1)$tables[$split[0]][]=array_slice($split,1);
  11.   }
  12.  if(isset($tables))foreach($tables as $id => $table){
  13. ?>
  14.   <table>
  15.    <thead>
  16.     <tr>
  17. <?php echo '     <th colspan="3">Tábla '.$id.'</th>'.PHP_EOL; ?>
  18.      </tr>
  19.     </thead>
  20.    <tbody>
  21. <?php
  22.  foreach($table as $line){
  23. ?>
  24.     <tr>
  25. <?php
  26.   foreach($line as $value)if($value!='')echo '     <td>'.$value.'</td>'.PHP_EOL;
  27. ?>
  28.      </tr>
  29. <?php
  30.   }
  31. ?>
  32.     </tbody>
  33.    </table>
  34.   <br />
  35. <?php
  36.   }
  37.  }
  38. ?>
  39.   </body>
  40.  </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement