Hi fibo,
It's going to take a while for me to get my head around this.
In the meantime:
http://www.rjsfitness.co.u
returns the following.
I still need of course the drop down menu.
I know I'm asking a lot, but as a graphic designer I'm blown away by how powerful php (and code in general) can be.
You guys are awesome.
So what next?
Very gratefully,
Owen
*** Initial data: Array ( [0] => 22_09_2009.html [1] => 21_09_2009.html [2] => 20_09_2009.html [3] => 19_09_2009.html [4] => 18_09_2009.html [5] => 17_09_2009.html [6] => 16_09_2009.html [7] => 15_09_2009.html [8] => 14_09_2009.html [9] => 13_09_2009.html [10] => 12_09_2009.html [11] => 11_09_2009.html [12] => 10_09_2009.html [13] => 09_09_2009.html [14] => 08_09_2009.html [15] => 07_09_2009.html [16] => 06_09_2009.html [17] => 05_09_2009.html [18] => 04_09_2009.html [19] => 03_09_2009.html [20] => 02_09_2009.html [21] => 01_09_2009.html [22] => 31_08_2009.html [23] => 30_08_2009.html [24] => 29_08_2009.html [25] => 28_08_2009.html [26] => 27_08_2009.html [27] => 26_08_2009.html [28] => 25_08_2009.html [29] => 24_08_2009.html [30] => 23_08_2009.html [31] => 22_08_2009.html [32] => 21_08_2009.html [33] => 20_08_2009.html [34] => 19_08_2009.html ) *** Randomized data: Array ( [0] => 11_09_2009.html [1] => 27_08_2009.html [2] => 02_09_2009.html [3] => 07_09_2009.html [4] => 21_08_2009.html [5] => 22_08_2009.html [6] => 20_09_2009.html [7] => 26_08_2009.html [8] => 16_09_2009.html [9] => 14_09_2009.html [10] => 19_09_2009.html [11] => 03_09_2009.html [12] => 01_09_2009.html [13] => 12_09_2009.html [14] => 15_09_2009.html [15] => 25_08_2009.html [16] => 29_08_2009.html [17] => 10_09_2009.html [18] => 06_09_2009.html [19] => 04_09_2009.html [20] => 30_08_2009.html [21] => 28_08_2009.html [22] => 20_08_2009.html [23] => 13_09_2009.html [24] => 17_09_2009.html [25] => 05_09_2009.html [26] => 21_09_2009.html [27] => 23_08_2009.html [28] => 18_09_2009.html [29] => 24_08_2009.html [30] => 08_09_2009.html [31] => 22_09_2009.html [32] => 09_09_2009.html [33] => 31_08_2009.html [34] => 19_08_2009.html ) *** unsorted files: Array ( [20090911] => 11_09_2009.html [20090827] => 27_08_2009.html [20090902] => 02_09_2009.html [20090907] => 07_09_2009.html [20090821] => 21_08_2009.html [20090822] => 22_08_2009.html [20090920] => 20_09_2009.html [20090826] => 26_08_2009.html [20090916] => 16_09_2009.html [20090914] => 14_09_2009.html [20090919] => 19_09_2009.html [20090903] => 03_09_2009.html [20090901] => 01_09_2009.html [20090912] => 12_09_2009.html [20090915] => 15_09_2009.html [20090825] => 25_08_2009.html [20090829] => 29_08_2009.html [20090910] => 10_09_2009.html [20090906] => 06_09_2009.html [20090904] => 04_09_2009.html [20090830] => 30_08_2009.html [20090828] => 28_08_2009.html [20090820] => 20_08_2009.html [20090913] => 13_09_2009.html [20090917] => 17_09_2009.html [20090905] => 05_09_2009.html [20090921] => 21_09_2009.html [20090823] => 23_08_2009.html [20090918] => 18_09_2009.html [20090824] => 24_08_2009.html [20090908] => 08_09_2009.html [20090922] => 22_09_2009.html [20090909] => 09_09_2009.html [20090831] => 31_08_2009.html [20090819] => 19_08_2009.html ) 19_08_2009
20_08_2009
21_08_2009
22_08_2009
23_08_2009
24_08_2009
25_08_2009
26_08_2009
27_08_2009
28_08_2009
29_08_2009
30_08_2009
31_08_2009
01_09_2009
02_09_2009
03_09_2009
04_09_2009
05_09_2009
06_09_2009
07_09_2009
08_09_2009
09_09_2009
10_09_2009
11_09_2009
12_09_2009
13_09_2009
14_09_2009
15_09_2009
16_09_2009
17_09_2009
18_09_2009
19_09_2009
20_09_2009
21_09_2009
22_09_2009
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:





by: fiboPosted on 2009-09-22 at 11:15:42ID: 25395794
Hi,
If I was to handle the problem, I would in fact name the files 2009_09_25.html, because then comparing filenames will be a very simple way to sort files / dates.
With your actual naming convention, it is of course possible but just needs additional processing.
This processing relies on 2 items:
- use Ksort instead of sort, so that the array is sorted along its keys and not along its values: using values would find that 30-08-2009 > 01-09-2009 which is not what you want
- and so you need to place the right key into the array the_files.
The key generation from filenames could be done with a regexp, but I just wanted the program to be simple to inspect.
Select allOpen in new window