On LIne 17, don't you mean sort instead of $sort?
Main Topics
Browse All TopicsHello Experts-
I've got a series of directories (2006, 2007, 2008), each with 12 directories (January, February, March...).
I'd like to print out links with the directories sorted, January, February, March...
If I do an a_January, b_February, c_March... I can do it but it's really ugly.
Any assistance greatly appreciated. I've been trying since dawn but can't get it to click.
Thanks in advance. Code's below, pretty lame.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ray, Thanks.
Not even that complicated. Just
2006
[link to January/]
[link to February/]
[link to March/]]
etc...
not specifying index.html, index.php, default.html.
Read the current directory and output a list a list of sub-directories as links.
I'm stuck on sorting the list of links as one would a human, January being the first link on the list, February being the second link on the list.
I could use a work-around, adding characters (a_, b_, _c) to the beginning of the directory names or carefully create the January, February, etc. directories so I could use the creation date / modification date to sort the list, those will break in the environment where this will be used, and both seem anti-php.
Thanks, Hugh
Ray-
I'm trying for bullet-proof. If it has to get moved to another server, it won't break, when there's additions, changes, the additions, changes will be automatically show up on the site, otherwise there's a good chance the navigation won't get updated.
Sometimes the list of links be will be in a table, sometimes in a list. Good chance that at some times the style will vary.
Thanks.
Hugh
Jagarm:
I can sort an array by an arbitrary value, I can print out a list of the files into an array, I can make nice names so it all passes for navigation. I can't put them together. I'm like one of those guys begging for regex help, frustration level gets pretty high, I've been looking at code and tutorials all day, but I remembered I'd joined this site a couple of weeks ago and thought I could get a hand.
Thanks, Hugh
I've set up some test directories and this seems to work.
http://www.laprbass.com/RA
I have to leave now, but the code is in the snippet. Hope that helps, ~Ray
Jagarm:
I can't depend on anyone being careful enough to name "March" as "c_March" next year. Sooner or later "e_May_2004" going to get renamed as "May_2004". I could carefully create the directory structure (make directory "January_2004" first, and "February_2004" after a second so I could use file dates to sort the lists but that's not sound.
Thanks, Hugh
Ray-
You're right. Hard to know what information to post.
Picture's worth a 1,000-
http://www.berner.org/gals
Click on the month, you go to the index file for that month (those are test pages, it's bad.)
The sorting of the links is artificial, though, because I named the folders a_January, b_February.
I just ran into a lot of trouble when I went to sort by anything arbitrary.
There are a lot of pictures. Menalto gallery, Coppermine, database support on my host, getting moved from server to server, doesn't seem to mix. I'm trying static html pages. I'll still have stuff going into Menalto, but if it falls apart, it's going to be easier for someone other than me to fix, they'll just have to restore the static pages from a backup on the site.
Sorry if a search for a php solution took you guys off course. Thanks for the ideas.
Hugh
Business Accounts
Answer for Membership
by: Ray_PaseurPosted on 2009-06-25 at 12:26:00ID: 24715013
If you know the names of the months, why not just use the names of the months?
Am I correct in understanding that you want to print out links to all the files in the directories organized like this:
2006
January
[link to file 1]
[link to file 2]
February
[ link to file 3]
... etc?