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

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 known to be wrong sometimes. He isn't afraid to admit it either (most of the
time..) time..)
<? // Display latest update <? // Display latest update
function sotcShowLatest($year) { function sotcShowLatest ($year) {
$i = 0; $i = 0;
$dirHandle = opendir ($year); $dirHandle = @opendir ($year);
if ($dirHandle) { if ($dirHandle) {
while ($fileName = readdir($dirHandle)) { while ($fileName = readdir ($dirHandle)) {
if ($fileName != '.' && $fileName != '..' && $fileName != 'CVS') { if ($fileName != '.' && $fileName != '..' && $fileName != 'CVS') {
$sotcList[$i++] = $fileName; $sotcList[$i++] = $fileName;
} }
@ -33,6 +33,8 @@ time..)
closedir ($dirHandle); closedir ($dirHandle);
rsort ($sotcList); rsort ($sotcList);
include ($year . '/' . $sotcList[0]); include ($year . '/' . $sotcList[0]);
} else {
echo 'There are no State of the Code announcements for this year.';
} }
} }