read in the filenames using the dir object (see reference), fill an array with them:
$d = dir(".");
$filelist = array();
while($filename = $d->read())
{
if($filename != '.' && $filename != '..' & (some other criteria to filter the right files))
array_push($filelist, $filename);
}
now sort the array using one of the sort functions provided by php.
sort($filelist);
produce the link list:
foreach($filelist as $listentry)
{
$lines = file($listentry);
$firstline = $lines[0];
echo "<a href=index.php?page=$listentry>"
.$firstline
."</a><br>";
}
hope this matches your needs!