Example 1: CSS
@media print {
body {
font-family: 'Times New Roman', Times, serif;
color: #000;
background-color: #fff;
}
}
#test {
color: #f00;
border: 5px dotted #00f;
}
/* There will of course be a novalist class */
.novalist { color: #0c0; }
The following block of PHP code is highlighted by Phi, a plugin developed by me.
Example 2: PHP
<?php
// Connect to database
$host = 'localhost';
$user = 'root';
$pass = 'foobarbaz';
$data = 'base';
try
{
if (!$link = @mysql_connect($host, $user, $pass))
{
throw new Exception(
'could not connect: '
. @mysql_error()
);
}
else if (!@mysql_select_db($data, $link))
{
throw new Exception(
'could not select DB: '
. @mysql_error($link)
);
}
}
catch (Exception $e)
{
die('Error encountered: ' . $e->getMessage());
}
// Get data from table
$sql = 'SELECT * FROM mytable';
$result = @mysql_query($sql, $link)
or die(
'Lazy to throw exceptions, but error encountered: '
. @mysql_error($link)
);
/**************** THIS LINE BULLIES INTERNET EXPLORER 6 HAHAHA ****************/
echo "<table>\n <tr>\n\t<th>ID</th>\n\t<th>Title</th>\n\t<th>Description</th>\n </tr>\n";
/**************** THIS LINE BULLIES INTERNET EXPLORER 6 HAHAHA ****************/
// Spit data or whatever else
if (mysql_num_rows($result) > 0)
{
while ($row = mysql_fetch_object($result))
{
$id = (int) $row->id;
$title = htmlspecialchars($row->title, ENT_QUOTES);
$desc = htmlspecialchars($row->desc, ENT_QUOTES);
?>
<tr>
<td><?=$id?></td>
<td><?=$title?></td>
<td><?=$desc?></td>
</tr>
<?php
}
}
else
{
echo " <tr>\n";
echo "\t<td colspan=\"3\">Nothing found, move along!</td>\n";
echo " </tr>\n";
}
/*
* But this
* lil' line
* doesn't
* bully IE6
*/
echo '</table>';
// And we're done
@mysql_close($link);
exit;
?>