Put them into an array and sort() the array.  The loop through the sorted
array and output at that point.

-Rasmus

On Wed, 21 Aug 2002, Øystein Håland wrote:

> When calling the function createLinks() I get an unsorted result, and that's
> NOT what I want. But I'm not able (lack of knowlegde) to sort the output
> (the links).
>
>  <?php
> function createLinks() {
>  $handle=opendir(".");
>  echo "<UL>\n";
>  while ($file = readdir($handle)){
>   if (($file == ".") || ($file == "..") || ($file == "index.php") || ($file
> == basename ($PHP_SELF))) { continue; }
>   if(is_file($file)) {
>    $linktext = ucfirst ($file);
>    $linktext = substr_replace ($linktext,'',-4);
>    echo "<LI>&nbsp;&nbsp;<A HREF=\"$file\">$linktext</A>\n";
>   }
>  }
>  echo "</UL>\n";
>
>  return true;
> }
> ?>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to