Skip to content

Instantly share code, notes, and snippets.

@oliveiraev
Created January 6, 2012 13:18
Show Gist options
  • Save oliveiraev/1570554 to your computer and use it in GitHub Desktop.
Save oliveiraev/1570554 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html lang="pt-Br">
<head>
<meta charset="UTF-8">
<title></title>
<style>
table {
border: none;
}
td {
padding: 7px;
text-align: center;
}
.highlight {
background: #000;
color: #f00;
}
</style>
</head>
<body>
<table><?php
foreach (range(0, 80) as $n) {
$c = $n % 9;
$l = floor($n / 9);
$css = null;
$line_begin = null;
$line_end = null;
$cell_value = '-';
if (!$c) $line_begin = "\n\t\t<tr>";
if ($c == $l or $c + $l == 8) $css = 'class="highlight"';
if ($c == 4 or $l == 4) $cell_value = '+';
if ($c == 8) $line_end = "\n\t\t</tr>";
$cell = "\n\t\t\t<td {$css}>{$cell_value}</td>";
echo $line_begin, $cell, $line_end;
}
?>
</table>
</body>
</html>
@oliveiraev
Copy link
Author

P.S.: Veja a marcação gerada ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment