Stavros Posted April 21, 2011 Share Posted April 21, 2011 Hi all I have been trying to sort this one out for hours now. I just need to sort my list alphabetically, any advise appreciated. This what I have so far if ($handle = opendir('./Items/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<a class ="preview" href=Items/'.$file.'>'.$file.'</a> <br>'; } } closedir($handle); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $Pics = array ($thelist); sort($Pics); foreach ($Pics as $key => $val) {echo "Pics[" . $key . "] = " . $val . "\n";} Quote Link to comment Share on other sites More sharing options...
requinix Posted April 21, 2011 Share Posted April 21, 2011 Are you outputting a JavaScript array? Do you really want the HTML in there as well? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.