Source Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Excuse of the Day</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://www.netvibes.com/api/0.3/style.css" />
<script type="text/javascript" src="http://www.netvibes.com/api/0.3/emulation.js"></script>
</head>
<body>
<?php
$theStyle = "fancy";
if(!empty($_COOKIE['theStyle'])) {
$theStyle = $_COOKIE['theStyle'];
}
?>
<form class="configuration" method="post" action="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<label for="theStyle">Style:</label>
<select name="theStyle" id="theStyle">
<?php
if($theStyle == "fancy") {
?>
<option selected="selected">fancy</option>
<option>minimalist</option>
<?php } else { ?>
<option selected="selected">minimalist</option>
<option>fancy</option>
<?php } ?>
</select>
<br />
<input type="submit" value="Configure" />
</form>
<?php
require_once('magpierss/rss_fetch.inc');
$url = 'http://meyerweb.com/feeds/excuse/rss20.xml';
$rss = fetch_rss($url);
$items = array_slice($rss->items, -1); // Keep only the last ("most recent," according to Meyer) result
foreach ( $items as $item ) {
echo "<em>The Excuse of the Day for ".date("n/j/y")." is...</em>\n";
if ($theStyle == "fancy") {
?>
<div style="width: 100%; text-align: center; font-weight: bold; font-family: 'Adobe Garamond', Garamond, Georgia, serif; font-size: 1.5em; clear: both; margin-top: 5px;">
<?php
echo $item['content']['encoded'];
echo "\n</div>\n";
} else {
echo $item['content']['encoded'];
echo ".\n";
}
}
?>
</body>
</html>