View Single Post
Old 03-05-2004, 07:18 PM   #2 (permalink)
MrFlux
Fluxing wildly...
 
MrFlux's Avatar
 
Location: Auckland, New Zealand
I can't quite work out the logic in my head but im pretty sure you could do it using getlastmod() and sort($array,SORT_NUMERIC)

Personally, I use a database for my photo gallery, with a date column so I can sort by date added...

You could use a multidimensional array, each file has a stored filename and date modified

e.g.

$thumbs[0][0] = 'filename.jpg'
$thumbs[0][1] = '324729874'

then use array_multisort() to sort by [i][1] then just display the images using foreach


second edit:

here's some code posted on PHP.net for sorting multidimensional arrays:

PHP Code:
<?php
function matrixSort(&$matrix,$sortKey) {
   foreach (
$matrix as $key => $subMatrix)
       
$tmpArray[$key] = $subMatrix[$sortKey];
   
arsort($tmpArray);
   return 
array_merge($tmpArray,$matrix);
}
?>
Of course, I could be going about this totally the wrong way...
__________________
flux (n.)
Medicine. The discharge of large quantities of fluid material from the body, especially the discharge of watery feces from the intestines.

Last edited by MrFlux; 03-05-2004 at 07:25 PM..
MrFlux is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76