";
// INITIALIZE COUNTERS
$nws = 0; $fts = 0; $trv = 0; $spt = 0; $biz = 0; $edt = 0;
// OPEN FLAT-FILE READ-ONLY
$fp = fopen('../fDB_indexstories.txt','r'); // All columnists are stored in a flat-file in subdirectory 'inc_files'
// CHECK FLAT-FILE EXISTS
if (!$fp) { $allstories = "ERROR: File 'fDB_indexstories.txt' could not be found!\n"; print $allstories; exit;}
// PARSE FLAT-FILE
while (!feof($fp)) {
$line = fgets($fp, 2048);
list($iS_vis, $iS_sec, $iS_ord, $iS_filename, $iS_headline) = explode('===', $line);
// HAWAII NEWS
if ($stat_nws == 'Y') {
// STORIES
if ($iS_sec == 'nws' && $iS_vis == ' Y' /* && $iS_ord == 'sto' */) {
$nws++;
displaySection($nws, $iS_sec);
$secPath = 'http://' . $site . $path_nws;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'nws' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $nws++;
// displaySection($nws, $iS_sec);
// $secPath = 'http://' . $site . $path_nws;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// FEATURES
if ($stat_fts == 'Y') {
// STORIES
if ($iS_sec == 'fts' && $iS_vis == ' Y') {
$fts++;
displaySection($fts, $iS_sec);
$secPath = 'http://' . $site . $path_fts;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'fts' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $fts++;
// displaySection($fts, $iS_sec);
// $secPath = 'http://' . $site . $path_fts;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// TRAVEL
if ($stat_trv == 'Y') {
// STORIES
if ($iS_sec == 'trv' && $iS_vis == ' Y') {
$trv++;
displaySection($trv, $iS_sec);
$secPath = 'http://' . $site . $path_trv;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'trv' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $trv++;
// displaySection($trv, $iS_sec);
// $secPath = 'http://' . $site . $path_trv;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// SPORTS
if ($stat_spt == 'Y') {
// STORIES
if ($iS_sec == 'spt' && $iS_vis == ' Y') {
$spt++;
displaySection($spt, $iS_sec);
$secPath = 'http://' . $site . $path_spt;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'spt' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $spt++;
// displaySection($spt, $iS_sec);
// $secPath = 'http://' . $site . $path_spt;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// BUSINESS
if ($stat_biz == 'Y') {
// STORIES
if ($iS_sec == 'biz' && $iS_vis == ' Y') {
$biz++;
displaySection($biz, $iS_sec);
$secPath = 'http://' . $site . $path_biz;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'biz' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $biz++;
// displaySection($biz, $iS_sec);
// $secPath = 'http://' . $site . $path_biz;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// EDITORIAL
if ($stat_edt == 'Y') {
// STORIES
if ($iS_sec == 'edt' && $iS_vis == ' Y') {
$edt++;
displaySection($edt, $iS_sec);
$secPath = 'http://' . $site . $path_edt;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'edt' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $edt++;
// displaySection($edt, $iS_sec);
// $secPath = 'http://' . $site . $path_edt;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
// SPECIAL
if ($stat_spc == 'Y') {
// STORIES
if ($iS_sec == 'spc' && $iS_vis == ' Y') {
$spc++;
displaySection($spc, $iS_sec);
$secPath = 'http://' . $site . $path_spc;
displayStory($secPath, $iS_filename, $iS_headline);
}
// BRIEFS
// if ($iS_sec == 'spc' && $iS_vis == ' Y' && $iS_ord == 'brf') {
// $spc++;
// displaySection($spc, $iS_sec);
// $secPath = 'http://' . $site . $path_spc;
// displayStory($secPath, $iS_filename, $iS_headline);
// }
}
$fp++;
}
// CLOSE FLAT-FILE
fclose($fp);
$allstories .= "
";
// Output to static file
$output = isset($_GET['output']);
if ($output == 'static') {
$myfile = '../indexai.html';
if ($file = fopen($myfile, 'w+')) { // Open file for writing
fwrite($file, $allstories);
print "SUCCESS! Output to file 'indexai.html' complete.";
} else {
print "ERROR! Unable to output to file!";
}
}
// Display output to browser
print $allstories;
?>