// Another script do display news from files in a directory. // This version does not use the UNIX ls command and works also on Windows NT. // Files will be sorted in descending order by modification date // 7.9.1998 Benjamin Stocker, n&s Informationssysteme, 4900 Langenthal, Swiss // email: BenjaminS@n-s.ch 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 ""; } $hd->close(); ?>
\n"; print "".date("d.m.Y - H:i:s",$newsfile[$key])."
\n"; for ($i=0; $i<$n; $i=$i+1) { $s=chop($fa[$i]); $s=htmlspecialchars($s); $s=createurl($s); print $s."
\n"; } print "