Jump to content

Recursively display directory help


JD*

Recommended Posts

Hey everyone,

 

I'm trying to write a piece of code that will allow me to recursively look through a directory and list contents. I've tried a bunch of pre-made scripts but nothing is working correctly so far and I'm spent trying to figure it out.

 

What we have is a list of students that a teacher can click on an individual student, and then see different documents that have been uploaded from previous years. On the file system, they're stored in a path like:

/srv/www/website.com/files/student_number/2008-2009/language_arts/entry1.pdf

/srv/www/website.com/files/student_number/2008-2009/language_arts/entry2.pdf

 

What I'm looking to have is each directory from the year on down as an <h3> which I can then use some jquery to either make an accordion or some other effect, so the teachers can drill down. I was able to get the year to work, but everything below, not so much, as the looping wasn't being very flexible.

 

Also, when putting all of this into an array, it would list entry2 first, then entry1. I want to sort the array, but since it's all contained in one giant array, sorting just screws it all up.

 

Thanks for any help!

 

Link to comment
https://forums.phpfreaks.com/topic/195603-recursively-display-directory-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.