function getThreeAnnouncements() { $handle = openFile( "announcements", "r"); if ( $handle != -1 ) { $ann = fgets($handle); for ($i=0; (!feof($handle) && $i<3); $i++) { //echo $ann; $pieces = explode("|", $ann); echo "
$pieces[0]: $pieces[1]
"; $ann = fgets($handle); } if ( $i == 0 ) { noAnnouncements(); } } else { noAnnouncements(); } } function getAnnouncements() { $handle = openFile( "announcements", "r" ); if ( $handle != -1 ) { $ann = fgets($handle); for ($i=0; !feof($handle); $i++) { //echo $ann; $pieces = explode("|", $ann); echo "$pieces[0]: $pieces[1]
"; $ann = fgets($handle); } if ( $i == 0 ) { noAnnouncements(); } } else { noAnnouncements(); } } function openFile( $fileName, $options ) { if ( file_exists( $fileName ) ) $handle = fopen( $fileName, $options ); else $handle = -1; return $handle; } function getNotes() { $handle = openFile( "notes", "r" ); if ( $handle != -1 ) { $notes = fgets($handle); for( $i=0; !feof($handle); $i++) { //first piece is chapter number, second piece is description, last piece is file name //if any of the first two pieces are missing then only the supplied piece is used //the last piece must always be there. And there must always be two | $pieces = explode("|", $notes); if ( $pieces[0] != "" && $pieces[1] != "" ) echo "$pieces[0]: $pieces[1]
|