Advertisement
Guest User

Untitled

a guest
Nov 14th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  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(($split=explode(';',$line))!==FALSE)$tables[$split[0]][]=array((isset($split[1])?$split[1]:''),(isset($split[2])?$split[2]:''),(isset($split[3])?$split[3]:''));
  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)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