Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to arrange files that are displayed using PHP
    text
    copied!<pre><code>&lt;div style="width: 49%; height: 300px; float: left; padding-top: 10px; "&gt; &lt;h2&gt;&lt;img src="downloads/general.png"&gt;&lt;/h2&gt; &lt;h1&gt;General Downloads&lt;/h1&gt; &lt;?php $Dirdownloads = opendir('downloads/general'); while (false !== ($file = readdir($Dirdownloads))) { if ($file != "." &amp;&amp; $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 '&lt;a href="downloads/general/'.$file[1].'"&gt;'.$file[1].'&lt;/a&gt;&lt;br /&gt;'; } ?&gt; &lt;/div&gt; &lt;div style="width: 49%; height: 300px; float: right; padding-top: 10px; "&gt; &lt;h2&gt;&lt;img src="downloads/conference.jpg"&gt;&lt;/h2&gt; &lt;h1&gt;Conference Information&lt;/h1&gt; &lt;?php $Dirdownloads = opendir('downloads/conference'); while (false !== ($file = readdir($Dirdownloads))) { if ($file != "." &amp;&amp; $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 '&lt;a href="downloads/conference/'.$file[1].'"&gt;'.$file[1].'&lt;/a&gt;&lt;br /&gt;'; } ?&gt; &lt;/div&gt; &lt;div style="width: 49%; height: 300px; float: left; padding-top: 10px; "&gt; &lt;h2&gt;&lt;img src="downloads/newsletter.jpg"&gt;&lt;/h2&gt; &lt;h1&gt;Newsletters&lt;/h1&gt; &lt;?php $Dirdownloads=opendir('downloads/newsletters'); while (false !== ($file = readdir($Dirdownloads))) { if($file != "." &amp;&amp; $file != ".."){ echo '&lt;a href="downloads/newsletters/'.$file.'"&gt;'.$file.'&lt;/a&gt;&lt;br /&gt;'; } } closedir($Dirdownloads); ?&gt; &lt;/div&gt; &lt;div style="width: 49%; height: 300px; float: right; padding-top: 10px; "&gt; &lt;h2&gt;&lt;img src="downloads/calendar.png"&gt;&lt;/h2&gt; &lt;h1&gt;Calendar&lt;/h1&gt; &lt;?php $Dirdownloads=opendir('downloads/calendars'); while (false !== ($file = readdir($Dirdownloads))) { if($file != "." &amp;&amp; $file != ".."){ echo '&lt;a href="downloads/calendars/'.$file.'"&gt;'.$file.'&lt;/a&gt;&lt;br /&gt;'; } } closedir($Dirdownloads); ?&gt; &lt;/div&gt; </code></pre> <p>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?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload