Sorting a php-generated list

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm using php to build a list of pages in my blog.

<h2 class="sidebar-title">Labels</h2>
<ul class="archive-list">
$ordner = "/var/www/html/blogger/labels";  // must your path
$handle = opendir($ordner);
while ($file = readdir ($handle)) {
if($file != "." && $file != "..") {
if(is_dir($ordner."/".$file)) {
echo "/".$file."<br/>";

} else {

// kompletter Pfad
$compl = substr($ordner, 13)."/".$file;   // adapt to path
$shortfile = substr($file, 0, -4);                // adapt to path
echo "<li><a href=\"".$compl."\">".$shortfile."</a></li>";



I found this script online, but what I really need is to sort the list
alphabetically. How would I go about doing that? Can anyone point me
in the right direction?


Re: Sorting a php-generated list

THE HAF wrote:
Quoted text here. Click to load it

sort(), arsort(), asort(), ksort(), krsort(), natsort(), natcasesort(),
rsort(), usort(), array_multisort() or uksort().
see <

-- Namensportal zu Richler Heiko Richler: Computer - Know How! private Homepage

Site Timeline