while ($record = mysql_fetch_array($result)) { # Output a divider between days if ($record["eventdate"] != $date) { if ($record["eventdate"] == $today) { $daylabel = "TODAY"; } else { if ($record["eventdate"] == $tomorrow) { $daylabel = "TOMORROW"; } else { # this should never happen but just in case... $daylabel = $record["eventdate"]; } } print " <item>\n"; print " <title>{$daylabel} ------------</title>\n"; print " <link>" . datelink($record["eventdate"]) . "</link>\n"; print " <pubDate>" . pubdate($record["eventdate"]) . "</pubDate>\r\n"; print " <description>Whole day's events</description>\n"; print " </item>\n"; $date = $record["eventdate"]; } # Output an event print " <item>\r\n"; print " <title>" . ($record['newsflash'] ? "[!] " : "") . hmmpm($record['eventtime']) . " " . htmlspecialchars($record['tinytitle']) . "</title>\r\n"; print " <link>" . eventlink($record['eventdate'], $record['id']) . "</link>\r\n"; print " <pubDate>" . pubdate($record['eventdate']) . "</pubDate>\r\n"; print " <description>"; print hmmpm($record['eventtime']); if ($record['timedetails']) { print " (" . htmlspecialchars($record['timedetails']) . ")"; }
$result = mysql_query("SELECT newsflash, tinytitle, eventtime, timedetails, locname, address, locdetails, printdescr FROM calevent, caldaily WHERE caldaily.id = calevent.id AND eventdate = \"{$tomorrow}\" AND eventstatus != \"C\" AND eventstatus != \"E\" AND eventstatus != \"S\" ORDER BY eventtime", $conn) or die(mysql_error()); # if there are events on this day... if (mysql_num_rows($result) > 0) { # Generate a nice human-readable version of the date $daylabel = date("l", strtotime($tomorrow)); if (mysql_num_rows($result) == 1) { $record = mysql_fetch_array($result); mysql_data_seek($result, 0); $daylabel .= ": " . htmlspecialchars($record["tinytitle"]); } else { $daylabel .= ": " . mysql_num_rows($result) . " events"; } # Start the entry for this date print " <item>\n"; print " <title>{$daylabel}</title>\n"; print " <link>" . datelink($tomorrow) . "</link>\n"; print " <pubDate>" . pubdate($tomorrow) . "</pubDate>\r\n"; print " <description>"; # The description consists of a list of entries for that date. while ($record = mysql_fetch_array($result)) { print "\n" . hmmpm($record["eventtime"]) . " " . htmlspecialchars($record["tinytitle"]) . "\n"; print " "; if ($record["locname"]) { print htmlspecialchars($record["locname"]) . ", "; } print htmlspecialchars($record["address"]); if ($record["locdetails"]) { print " (" . htmlspecialchars($record["locdetails"]) . ")"; } print "\n " . htmlspecialchars($record["printdescr"]) . "\n"; if ($record["newsflash"]) {
$daylabel = "Tomorrow"; } else { $daylabel = date("l", strtotime($date)); } } if (mysql_num_rows($result) == 1) { $record = mysql_fetch_array($result); mysql_data_seek($result, 0); $daylabel .= ": " . htmlspecialchars($record["tinytitle"]); } else { $daylabel .= ": " . mysql_num_rows($result) . " events"; } # Start the entry for this date print " <item>\n"; print " <title>{$daylabel}</title>\n"; print " <link>" . datelink($date) . "</link>\n"; print " <pubDate>" . pubdate($date) . "</pubDate>\r\n"; print " <description>"; # The description consists of a list of entries for that date. while ($record = mysql_fetch_array($result)) { print "\n" . hmmpm($record["eventtime"]) . " " . htmlspecialchars($record["tinytitle"]) . "\n"; print " "; if ($record["locname"]) { print htmlspecialchars($record["locname"]) . ", "; } print htmlspecialchars($record["address"]); if ($record["locdetails"]) { print " (" . htmlspecialchars($record["locdetails"]) . ")"; } print "\n " . htmlspecialchars($record["printdescr"]) . "\n"; if ($record["newsflash"]) {