Ciao a tutti,
ho trovato questo codice per leggere e stampare a schermo le cartelle (non i file) contenute in una cartella principale
codice:
<?php
$DirPath="../cartelle";
if($DirPath=="") {
$DirPath='./cartelle';
}
if (($handle=opendir($DirPath))) {
while ($node = readdir($handle)) {
$nodebase = basename($node);
if ($nodebase!="." && $nodebase!="..") {
if(is_dir($DirPath.$node)) {
$nPath=$DirPath.$node."/cartelle";
echo "-> -> -> <a href='mostra_file.php?a=$nPath'>
$node</a>
";
} else {
echo "

-> $node";
if ($a != "" && $a == $node){
$DirPath2="../cartelle/$a";
if($DirPath2=="") {
$DirPath2="./cartelle/$a";
}
Tuttavia l'ordine che ottengo non è "alfabetico", cioè del tipo:
Cartella 1
Cartella 2
Cartella 3
Cartella 4
Ma ottengo:
Cartella 2
Cartella 3
Cartella 1
Cartella 4

Come posso fare per ottenere l'ordine corretto??

Grazie