Mam nadzieję, że to dobry dział.
Szukałem po sieci skryptu, który wyświetlałby podkatalogi w danym katalogu i kierował do nich linkiem.
Znalazłem coś takiego:
<?php /* User configuration */ $showsize = 0; /* Show size of each file, 1 for yes, 0 for no. */ /* Array with file types to display and the pictures to use. Syntax: $display['filetype'] = "picture"; */ $display['php'] = "php.gif"; $display['html'] = "html.gif"; $display['htm'] = "html.gif"; $display['shtml'] = "html.gif"; /* Array with directories to exclude. Syntax: $excludedir[] = "directory"; */ $excludedir[] = "temp"; $excludedir[] = "tmp"; /* Array with files to exclude. */ $excludefile[] = "index.php"; $excludefile[] = "index2.php"; ?> <?php /* some preliminaries... */ /* Uncomment the 2 lines below to create a tree of all files and directories on your webserver if the script * is in a subdirectory */ //$root = str_replace($prefix, "", $root); //$prefix = ""; $root .= "/"; /* Display server name and directory */ /*echo "<tr><td><img align=absmiddle src=server.gif> http://".$_SERVER['SERVER_NAME'];*/ /*echo "$prefix/";*/ /*echo "</td></tr><tr><td><img align=absmiddle src=vertical.gif></td></tr>\n";*/ function get_extension($name) { return $retval; } /* Recursion, here we go.. */ function list_dir($chdir) { /* some globals, some cleaning */ /* open current directory */ /* read directory. If the item is a directory, place it in $sdirs, if it's a filetype we want * and not this file, put it in $sfiles */ { { $sdirs[] = $file; } { $sfiles[] = $file; } } /* count the slashes to determine how deep we're in the directory tree and how many * nice bars we need to add */ /* display directory names and recursively list all of them */ for($y=0; $y<sizeof($sdirs); $y++) { echo "<a style='color:#000; text-decoration:none;' href=\"http://".$_SERVER['SERVER_NAME']."$prefix/$dir1$sdirs[$y]\">$sdirs[$y]</a>"; list_dir($dir."/".$sdirs[$y]); } } /* iterate through the array of files and display them */ /* what file types shall be displayed? */ for($y=0; $y<$sizeof; $y++) { } for($z=1; $z<=$count; $z++) } } list_dir($root); ?>
W czym problem?
Skrypt wyświetla katalogi oraz działa w taki sposób jak chciałem czyli po wy-listowaniu nazw katalogów kieruje do nich linkiem (czyli nazwa = link).
Problem w tym, że mam w katalogu również foldery zawierające polskie znaki np. tak:
- Warszawa
- Bydgoszcz
- Zakopane
- Łódź (jednak tutaj wyświetla mi tylko Łód - brak "ź" przez co również link nie działa. Link wygląda tak: www.mojastrona/katalog/Łód <-na końcu spacja zamiast "ź")
- MPK Łódź (tutaj również brak "ź" - nie wiem co ze spacją w nazwie folderu, czy działa jakoś na poprawność działania linku)
Moje pytanie jest następujące:
Co zrobić aby skrypt wyświetlał polskie znaki oraz aby link kierował do folderu który posiada w nazwie właśnie polskie znaki?
Jeśli nie ma szans aby ten skrypt działał wedle moich oczekiwań to czy macie może jakieś inne pomysły jak uzyskać pożądany efekt?
Pozdrawiam wszystkich.