Educating the world

Our blog has over 10,000 readers a month

« rm: Argument list too longPlesk Awstat forgets the monthly statistics »


Comment from: Andrew [Visitor]

Thank you - I like option 2 for php. Is there an easy way to incorporate the following code to sort the index page files by date? This would be useful for sites to list the most recent files near the top.

I see there is code like this but it’s not complete (from ):

[codeblock lang="php” line="1″]
$content_array = array();

//set current working directory
$dirname = “C:\temp";

//Load Directory Into Array
while ($file = readdir($handle))
if ($file != “.” && $file != “..")
$content_array[$i][0] = $file;
$content_array[$i][1] = date ("Y m d", filemtime($dirname."/".$file));
//close the directory handle

// these lines sort the contents of the directory by the date
foreach($content_array as $res)
$sortAux[] = $res[1];
array_multisort($sortAux, SORT_ASC, $content_array);

01/10/08 @ 14:37
Comment from: Wiboon Warasittichai [Visitor]
Wiboon Warasittichai

Can you make directory list in a drop-down menu? Thanks.

10/10/08 @ 08:19
Comment from: davidnewcomb [Member]  

Yes - you can!

10/10/08 @ 11:00
Comment from: Dretoot [Visitor]

Your writing is very elegant, very vivid and lively, I really like you, wish you continued to write better articles, I will often try to concern, oh!

24/03/10 @ 08:26

Leave a comment

Your email address will not be revealed on this site.

Your URL will be displayed.
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)