On Wednesday 21 August 2002 06:41, Øystein Håland wrote:
> "Put them into an array and sort() the array.  The loop through the sorted
> array and output at that point."
> Just what I try. But, because of my lack of understanding, the output is my
> problem:

You're not doing what has been suggested above. See comments below.

1) In your while loop only read in the filenames into an array (discarding '.' 
and '..').

2) Then sort the array.

3) Then use a foreach to loop through the array elements to create the links.

> function createLinks() {
>  $p = 0;
>  $handle=opendir(".");
>  echo "<UL>\n";
>  while ($file = readdir($handle)){
You've read in a filename

>   $files[] = $file;
And added it to the array

>   $sorted = sort($files);
Then sort the array, but why? You haven't read in ALL the files yet so why 
sort now? Also you're not using the results of the sorted filenames ($sorted) 
anywhere else in your code.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

The Anglo-Saxon conscience does not prevent the Anglo-Saxon from
sinning, it merely prevents him from enjoying his sin.
                --Salvador De Madariaga

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to