\n \n\n"; $handle = opendir('.'); // ---- count the num. of files so you can divide it into two table cells $fileCount=0;while (readdir($handle)) { $fileCount++; } if ($fileCount % 2 == 0) $halfWayNumber = $fileCount/2 - 1; if ($fileCount % 2 != 0) $halfWayNumber = $fileCount/2 -1.5; closedir($handle); $handle = opendir('.'); // ---- Read each file name & title from the directory $thisCount = "0"; while ($thisFile = readdir($handle)) { // ---- display files in this section if(stristr($thisFile,".txt") || stristr($thisFile,".php3")){ $fd = fopen("$thisFile", "r"); while (!feof($fd)) { $buffer = fgets($fd,255); if (stristr($buffer,"

")){ $thisCount++; $hstart = strpos($buffer,"

"); $hend = strpos($buffer,"

"); $thisTitle = substr($buffer, $hstart+15, ($hend - $hstart)-15); if($thisFile != $fileName) print"
  • $thisTitle
    \n"; } } fclose($fd); } // ---- display folders in this section if (is_dir($thisFile) && !strstr($thisFile,".")){ $thisCount++; $dirName = str_replace("_", " ", $thisDir); print "
  • ".ucwords($dirName)."
    "; } if($thisCount == $halfWayNumber) print "\n"; } print "

    \n\n"; closedir($handle); if (!$thisTitle) print "nothing yet\n"; print "\n"; } dispSection($section,$fileName); ?>