Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!DOCTYPE HTML>
  2. <html lang="pt-Br">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title></title>
  6.     <style>
  7.         table {
  8.             border: none;
  9.         }
  10.  
  11.         td {
  12.             padding: 7px;
  13.             text-align: center;
  14.         }
  15.  
  16.         .highlight {
  17.             background: #000;
  18.             color: #f00;
  19.         }
  20.     </style>
  21. </head>
  22. <body>
  23.     <table><?php
  24.  
  25.     foreach (range(0, 80) as $n) {
  26.         $c          = $n % 9;
  27.         $l          = floor($n / 9);
  28.         $css        = null;
  29.         $line_begin = null;
  30.         $line_end   = null;
  31.         $cell_value = '-';
  32.  
  33.         if (!$c)                        $line_begin = "\n\t\t<tr>";
  34.         if ($c == $l or $c + $l == 8)   $css        = 'class="highlight"';
  35.         if ($c == 4  or $l == 4)        $cell_value = '+';
  36.         if ($c == 8)                    $line_end   = "\n\t\t</tr>";
  37.  
  38.         $cell       = "\n\t\t\t<td {$css}>{$cell_value}</td>";
  39.  
  40.         echo $line_begin, $cell, $line_end;
  41.  
  42.     }
  43.  
  44.     ?>
  45.  
  46.     </table>
  47. </body>
  48. </html>