Update SotC page to exit gracefully when there are no SotC announcements

for the current year.
This commit is contained in:
Jeff Teunissen 2001-01-14 01:54:33 +00:00
parent 61053ca04f
commit ad8a68e795
1 changed files with 5 additions and 3 deletions

View File

@ -20,12 +20,12 @@ necessary - contrary to popular (with him) belief, Knghtbrd has in fact been
known to be wrong sometimes. He isn't afraid to admit it either (most of the
time..)
<? // Display latest update
function sotcShowLatest($year) {
function sotcShowLatest ($year) {
$i = 0;
$dirHandle = opendir ($year);
$dirHandle = @opendir ($year);
if ($dirHandle) {
while ($fileName = readdir($dirHandle)) {
while ($fileName = readdir ($dirHandle)) {
if ($fileName != '.' && $fileName != '..' && $fileName != 'CVS') {
$sotcList[$i++] = $fileName;
}
@ -33,6 +33,8 @@ time..)
closedir ($dirHandle);
rsort ($sotcList);
include ($year . '/' . $sotcList[0]);
} else {
echo 'There are no State of the Code announcements for this year.';
}
}