Advertisement
Linux-Fan

A simple Chartable in PHP

Aug 11th, 2014
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <html>
  2. <head><title>Entities</title>
  3. <style type="text/css">
  4. /* <![CDATA[ */
  5. code { font-size: 40px; }
  6. table { border-collapse: collapse; }
  7. table, tr, td, th { border: 1px solid #ffffff; }
  8. th, td { max-width: 64px; width: 64px; overflow: auto; text-align: center; }
  9. th { font-size: 15px; height: 32px; }
  10. td { font-size: 10px; height: 64px; }
  11. .type_a { background-color: #cccccc; }
  12. .type_b { background-color: #999999; }
  13. .type_e { background-color: #ff0000; }
  14. /* ]]> */
  15. </style>
  16. <body><table border="0" cellpadding="0" cellspacing="0">
  17. <?php
  18. $start = 8448;
  19. $end = 8543;
  20. $width = 9;
  21.  
  22. if(isset($_GET['start']) AND isset($_GET['end']) AND isset($_GET['width'])) {
  23.     $start = (int)$_GET['start'];
  24.     $end   = (int)$_GET['end'];
  25.     $width = (int)$_GET['width'];
  26. }
  27.  
  28. echo("<tr>");
  29. for($i = 0; $i < $width; $i++) {
  30.     $type = "e";
  31.     if(($i % 2) == 0) {
  32.         $type = "b";
  33.     } else {
  34.         $type = "a";
  35.     }
  36.     echo("<th class=\"type_".$type."\">Nr</th><th class=\"type_".$type."\">Val</th>");
  37. }
  38. echo("</tr>\n");
  39. for($i = $start; $i <= $end; $i=$i+$width) {
  40.     echo("<tr>");
  41.     for($j = $i; $j < $i+$width; $j++) {
  42.         $type = "e";
  43.         if(($j % 2) == 0) {
  44.             $type = "a";
  45.         } else {
  46.             $type = "b";
  47.         }
  48.        
  49.         echo("<td class=\"type_".$type."\">&amp;#".$j.";</td><td class=\"type_".$type."\"><code>&#".$j."</code></td>");
  50.     }
  51.     echo("</tr>\n");
  52. }
  53. ?>
  54. </table></body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement