Hello everyone!!!
I have this problem:
http://pastebin.com/m114f9992
Just to add a few more hints to the problem:
i've manage to get a tree of directorys going, with all hierachy perfect align
dir1
dir1.1
dir 2
(etc)
The problem is: they are not sorted out by name..someone told me i should use arrayobject class to do this...what i'm guessing is i've got to implement some kind of class that will sort out the variable $dir ( that is the result of the recursive directory listing function )
So, i'm calling it like this
$dir = new RecursiveIteratorIterator(new RecursiveDirIterator($directorio_call), true);
foreach ( $dir as $file ) {
etc etc
should it be something like before the for each
$sorted = new ClassThatSorts($dir)
$sorted->sort();
and then the for each?
how can i do this? i've been at a lot of foruns and mirc!
Please!!
Thank you very very very much!!
Ricardo
arrayobject and directory listing
Moderator: General Moderators
Re: arrayobject and directory listing
Any ideas?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: arrayobject and directory listing
What are you trying to do?
Re: arrayobject and directory listing
Hello sir
I want to have this ( pic below - which i have ) sorted by name ( which i dont have ).
So i want to get all files and directorys using, for instance SPL and sort out the results.
I've bee told that SPL doesn't allowed that and i need to put the directorys inside an array and sort the array out.
Any ideas?

I want to have this ( pic below - which i have ) sorted by name ( which i dont have ).
So i want to get all files and directorys using, for instance SPL and sort out the results.
I've bee told that SPL doesn't allowed that and i need to put the directorys inside an array and sort the array out.
Any ideas?

- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: arrayobject and directory listing
You could use something like glob(), but the spl stuff works good too. I say search around here for author feyd and use the term directory iterator. He did something amazing once with that tool.