[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [PHP] Sortering af fil liste



On Fri, 2 Jan 2004, s_teknik wrote:

> Jeg har en stump kode der skal lave en filliste.
> Koden går ind og læser alle de filer der ligger i et bibliotek. MEN??den 
> sætter ikke filerne i alfabetisk rækkefølge, er der nogle der kan hjælpe?

Smid data ind i et array, sortér data og skriv dem ud.

> Jeg ved intet om php!
> 
> <?
> $dir = "A\\";
> // Open a known directory, and proceed to read its contents
> if (is_dir($dir))
> {
> if ($dh = opendir($dir))
> {
 while (($file = readdir($dh)) !== false) {
	if (!($file == '.') && !($file == '..'))
		$liste[] = $file;
 }
 closedir($dh);
 sort(liste);
 foreach ($liste as $dname)
	echo '<a href="'.$dir.$dname.'">'.$dname.'</a><br>';

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
I spent probably 20 or 30 hours drawing the penguin stuff, and
I've spent four or five years writing code, and I'm still
known for the penguin a lot more than I am for any of the code.
			-- Larry Ewing, creator of Tux


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *