As I only get one very very tiny part of the PHP phenomenon I'm very happy that I managed to create the following script by searching the web. As you can see, this shows the files present in the folder 'archive' on the website I'm building. It's for the newspaper of my school. The old papers will be uploaded to this folder. A problem is that the order is very messy at the moment. I know PHP can sort things with sort(), but I'm not sure how to do that in this case. Could anyone explain how to get it fixed?
Another thing is hiding the extensions. I couldn’t find it yet, is there a possibility for that?
You’d be a great help if you could help me at least with the first thing :)
<?php
if ($handle = opendir(archive)) {
$ignore_files = array('.', '..', '.htaccess', '.htpasswd', 'index.php');
while (false !== ($file = readdir($handle)))
{
if (!in_array($file, $ignore_files))
{
$thelist .= '<a href="/archive/'.$file.'">'.$file.'</a>'.'<br>';
}
}
closedir($handle);
}
?>
<p><?=$thelist?></p>