000
21.09.2003, 17:53
Spike
|
kann man per php den dateiindex des betriebssystems eines bestimmeten ordners nach namen sortieren ?
also das script soll ungefähr das gleiche machen, wenn ich mit der rechten maustaste in einen ordner klicke und dann nach namen sortieren anwähle.
--
Kill? Box? Killbox! Die Intelligenz ist eine Konstante, nur die Bevölkerung wächst.
|
|
Profil || Suche
|
001
21.09.2003, 17:58
the_viking
|
Also afaik gibt es da keine Funktionen. Und unter windows wird das ganze (anzeige, sortierung) wahrscheinlich entweder in der reg oder in ner Datei gespeichert...
--
thx, cu, MfG the_viking
(( My =]=H=O=M=E=> Page! )) Coder bei Brainshock-Interactive und bei Z-Software My ICQ: #160959446
|
|
Profil || Suche
|
002
21.09.2003, 18:20
theDon
|
wenn du nur alle files in der liste alphabetisch haben willst, dann pack sämtliche namen in ein array und sortiere das.
--
\o tanz den naziprau! o/
And more than ever, I hope to never fall, Where enough is not the same it was before
|
|
Profil || Suche
|
003
21.09.2003, 18:38
Spike
|
genau da liegt mein problem. ich weiß nicht wo ich die sort() funtion ansetzten soll, deswegen dachte ich, dass es einfacher ist, den dateiindex zu sortieren.
vieleicht kannst du mir sagen wie ich das sort da einbaues kann:
<?php function myoutput() { global $dirnum; global $filenum; global $allfilesize;
$verz=opendir ('.'); while ($file = readdir ($verz)) { if ($file != '.' && $file != '..' && $file != 'index.php') { if (filetype($file) == 'dir') { $dirnum++; $thefolders[$dirnum][name] = mk_xhtml_f_name($file).'/'; $thefolders[$dirnum][dname] = mk_xhtml_f_name($file); $thefolders[$dirnum][date] = date("d.m.Y - H.i.s",filemtime($file)); } elseif (filetype($file) == 'file') { $filenum++;
ereg(".*\.([_A-Za-z0-9]{0,})$",$file,$filetype);
$thefiles[$filenum][name] = mk_xhtml_f_name($file); $thefiles[$filenum][size] = filesize($file); $thefiles[$filenum][date] = date("d.m.Y - H.i.s",filemtime($file)); $thefiles[$filenum][img] = getfiletypeimage($filetype[1]);
$allfilesize += filesize($file); } } } closedir($verz);
// AUSGABE Ordner for ($i=1; $dirnum >= $i ; $i++) { echo ' <tr bgcolor="#304070"> <td align="left" width="20" height="22"><img src="/icons/folder.gif" alt="" /></td> <td align="left" width="300" height="22"><a href="'.$thefolders[$i][name].'">'.$thefolders[$i][dname].'</a></td> <td align="left" width="170" height="22"><font>'.$thefolders[$i][date].'</font></td> <td align="left" width="200" height="22"><font>-</font></td> </tr>'; }
// AUSGABE Dateien for ($i=1; $filenum >= $i ; $i++) { echo ' <tr bgcolor="#304070"> <td align="left" width="20" height="22"><img src="/icons/'.$thefiles[$i][img].'" alt="" /></td> <td align="left" width="300" height="22"><a href="'.$thefiles[$i][name].'">'.$thefiles[$i][name].'</a></td> <td align="left" width="170" height="22"><font>'.$thefiles[$i][date].'</font></td> <td align="left" width="200" height="22"><font>'.$thefiles[$i][size].' Bytes</font></td> </tr>'; }
clearstatcache(); } ?>
--
Kill? Box? Killbox! Die Intelligenz ist eine Konstante, nur die Bevölkerung wächst.
|
|
Profil || Suche
|
004
21.09.2003, 20:19
Small_Player
|
probier mal hilfe auf
www.php4-forum.de zu finden..die sind klasse und helfen alle..hier wirste nicht alle antworten auf PHP finden
--
Agamemnon-Hellmapper "Mithilfe der Dreifaltigkeit aus Suchfunktion, Tutorials und Hirn." www.MicHappe.de
|
|
Profil || Suche
|
005
23.09.2003, 15:40
Chronial
|
doch, wird er. Ich hasse dumme Werbung.
du musst einfach vor die Ausgabe (also nach closedir) folgendes schreiben:
<?php sort($thefiles); sort($thefolders); ?>
--
"tsuji-giri" (japanisch) - ein neues Schwert an einem Passanten ausprobieren
Dieser Beitrag wurde am 23.09.2003 um 15:40 von Chronial bearbeitet.
|
|
Profil || Suche
|
006
23.09.2003, 18:19
Spike
|
funzt leider nicht, aber ich hab heute als ein freund bei mir war ne lösung gefunden. seine anweseheit hat gereicht und zack da hatte ich die lösung ;)
also wen es interessiert hier ist sie. ich hab einfach in ein normales array die namen gepackt und dann den ganzen info-kram später mit ner foreach gelöst:
<?php function myoutput() { global $dirnum; global $filenum; global $allfilesize;
$verz=opendir ('.'); while ($file = readdir ($verz)) { if ($file != '.' && $file != '..' && $file != 'index.php') { if (filetype($file) == 'dir') { $folderarray[] = $file; } elseif (filetype($file) == 'file') { $filearray[] = $file; } } } closedir($verz); if (sizeof($folderarray) > 0) { natcasesort($folderarray); foreach ($folderarray as $file) { $dirnum++; $thefolders[$dirnum][name] = mk_xhtml_f_name($file); $thefolders[$dirnum][name] = mk_xhtml_f_name($file).'/'; $thefolders[$dirnum][dname] = mk_xhtml_f_name($file); $thefolders[$dirnum][date] = date("d.m.Y - H.i.s",filemtime($file)); } } if (sizeof($filearray) > 0) { natcasesort($filearray); foreach ($filearray as $file) { $filenum++;
ereg(".*\.([_A-Za-z0-9]{0,})$",$file,$filetype);
$thefiles[$filenum][name] = mk_xhtml_f_name($file); $thefiles[$filenum][size] = filesize($file); $thefiles[$filenum][date] = date("d.m.Y - H.i.s",filemtime($file)); $thefiles[$filenum][img] = getfiletypeimage($filetype[1]);
$allfilesize += filesize($file); } } // AUSGABE Ordner for ($i=1; $dirnum >= $i ; $i++) { echo ' <tr bgcolor="#304070"> <td align="left" width="20" height="22"><img src="/icons/folder.gif" alt="" /></td> <td align="left" width="300" height="22"><a href="'.$thefolders[$i][name].'">'.$thefolders[$i][dname].'</a></td> <td align="left" width="170" height="22"><font>'.$thefolders[$i][date].'</font></td> <td align="left" width="200" height="22"><font>-</font></td> </tr>'; }
// AUSGABE Dateien for ($i=1; $filenum >= $i ; $i++) { echo ' <tr bgcolor="#304070"> <td align="left" width="20" height="22"><img src="/icons/'.$thefiles[$i][img].'" alt="" /></td> <td align="left" width="300" height="22"><a href="'.$thefiles[$i][name].'">'.$thefiles[$i][name].'</a></td> <td align="left" width="170" height="22"><font>'.$thefiles[$i][date].'</font></td> <td align="left" width="200" height="22"><font>'.$thefiles[$i][size].' Bytes</font></td> </tr>'; }
clearstatcache(); } ?>
aber nun hab ich ein weiteres problem (das auch nur unter linux auftritt), aber ich mach nen neunen thread, da das was anderes ist. danke für eure mühen.
den filelister werde ich später, wenn er fertig ist, mal releasen (landet dann warscheinlich im präsentations forum).
--
Kill? Box? Killbox! Die Intelligenz ist eine Konstante, nur die Bevölkerung wächst.
Dieser Beitrag wurde am 23.09.2003 um 18:22 von Spike_900 bearbeitet.
|
|
Profil || Suche
|