Another script to display news from files in a directory
This version does not use the UNIX ls command and works also on Windows NT
News
News
".$linktext. "".$b;
}
}
return($s);
}
// change this to the directory of your news files
// they should be plain ASCII text files with extension ".txt"
$newspath = "c:\\apache\\htdocs\\news\\";
// Declare array to hold filenames
$newsfile = array();
// Create handle to search directory $newspath for files
$hd = dir($newspath);
// Get all files and store them in array
while( $filename = $hd->read() ) {
$s=strtolower($filename);
if (strstr($s, ".txt")) {
// Determine last modification date
$lastchanged=filemtime($newspath.$filename);
$newsfile[$filename] = $lastchanged;
}
}
// Sort files in descending order
arsort($newsfile);
// Output files to browser
for(reset($newsfile); $key = key($newsfile); next($newsfile)) {
$fa = file($newspath.$key);
$n=count($fa);
print "