Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> sortowanie wg filemtime()
dtrevo
post 28.01.2009, 14:52:35
Post #1





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 5.12.2008

Ostrzeżenie: (0%)
-----


napisałem/skopiowałem taki skrypcik, ale nie chce mi sortować tej tablicy. Pozdrawiam
CODE

<?php



$fol = "galerie";
$uchwyt = opendir($fol);
while(false !== ($plik = readdir($uchwyt))){


$path = 'galerie';

$t = 0;
$f = 0;
$images_arr['name'] = array();
$images_arr['time'] = array();

if($plik!= "." && $plik!= "..") {
$fName = $plik;
$plik = $path.'/'.$plik.'/index.php';
if(is_file($plik)){

$images_arr['time'][$t++] = filemtime($plik);
$images_arr['name'][$f++] = $plik;

};
};
foreach ($images_arr['time'] as $key=>$atime){
echo 'przed - '.$atime;
}
echo '<br>';
asort( $images_arr['time'] );
asort( $images_arr['name'] );


//test
foreach ($images_arr['time'] as $key=>$ftime){
$fname = $images_arr['name'][$key];
echo 'po - '.$ftime;


echo '<tr>
<td width="10"><img src="grafika/jl.jpg" width="10" height="20"></td>
<td background="grafika/js.jpg"><a href="'.$fname.'" /> '.$fname.' <strong>filename:</strong> '.$fname.' <strong>filetime:</strong> '.$ftime.'<br/> </a></td>
<td width="10"><img src="grafika/jp.jpg" width="10" height="20"></td>
</tr>
';
}


}







?>



otrzymuje takie coś

CODE

przed - 1233074001
po - 1233074001







przed - 1233147629
po - 1233147629







przed - 1233074237
po - 1233074237





Ten post edytował dtrevo 28.01.2009, 20:49:24
Go to the top of the page
+Quote Post
milijkovic
post 28.01.2009, 22:23:49
Post #2





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 28.01.2009

Ostrzeżenie: (0%)
-----


chyba lepiej jak zrobisz na bazie
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 11:34