<div style="width: 49%; height: 300px; float: left; padding-top: 10px; ">
<h2><img src="downloads/general.png"></h2>
<h1>General Downloads</h1>
<?php
$Dirdownloads = opendir('downloads/general');
while (false !== ($file = readdir($Dirdownloads))) {
if ($file != "." && $file != "..") {
$files[] = array(
filemtime('downloads/general/'.$file),
$file
);
}
}
closedir($Dirdownloads);
usort($files, create_function('$a, $b', 'return $a[0] - $b[0];'));
foreach ($files as $file) {
echo '<a href="downloads/general/'.$file[1].'">'.$file[1].'</a><br />';
}
?>
</div>
<div style="width: 49%; height: 300px; float: right; padding-top: 10px; ">
<h2><img src="downloads/conference.jpg"></h2>
<h1>Conference Information</h1>
<?php
$Dirdownloads = opendir('downloads/conference');
while (false !== ($file = readdir($Dirdownloads))) {
if ($file != "." && $file != "..") {
$files[] = array(
filemtime('downloads/conference/'.$file),
$file
);
}
}
closedir($Dirdownloads);
usort($files, create_function('$a, $b', 'return $a[0] - $b[0];'));
foreach ($files as $file) {
echo '<a href="downloads/conference/'.$file[1].'">'.$file[1].'</a><br />';
}
?>
</div>
<div style="width: 49%; height: 300px; float: left; padding-top: 10px; ">
<h2><img src="downloads/newsletter.jpg"></h2>
<h1>Newsletters</h1>
<?php
$Dirdownloads=opendir('downloads/newsletters');
while (false !== ($file = readdir($Dirdownloads))) {
if($file != "." && $file != ".."){
echo '<a href="downloads/newsletters/'.$file.'">'.$file.'</a><br />';
}
}
closedir($Dirdownloads);
?>
</div>
<div style="width: 49%; height: 300px; float: right; padding-top: 10px; ">
<h2><img src="downloads/calendar.png"></h2>
<h1>Calendar</h1>
<?php
$Dirdownloads=opendir('downloads/calendars');
while (false !== ($file = readdir($Dirdownloads))) {
if($file != "." && $file != ".."){
echo '<a href="downloads/calendars/'.$file.'">'.$file.'</a><br />';
}
}
closedir($Dirdownloads);
?>
</div>
Is the code, which displays all the files in a certain folder, and allows you to download them. They are currently arranged by name, and I want to arrange them with newest first... Help?