PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Feb 23, 2020 2:42 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Apr 09, 2008 7:11 pm 
Offline
Forum Newbie

Joined: Wed Apr 09, 2008 7:07 pm
Posts: 13
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


Top
 Profile  
 
PostPosted: Thu Apr 10, 2008 10:20 am 
Offline
Forum Newbie

Joined: Wed Apr 09, 2008 7:07 pm
Posts: 13
Any ideas?


Top
 Profile  
 
PostPosted: Thu Apr 10, 2008 3:49 pm 
Offline
Site Administrator
User avatar

Joined: Tue Sep 09, 2003 6:04 pm
Posts: 14293
Location: Fremont, CA, USA
What are you trying to do?


Top
 Profile  
 
PostPosted: Thu Apr 10, 2008 5:13 pm 
Offline
Forum Newbie

Joined: Wed Apr 09, 2008 7:07 pm
Posts: 13
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?

Image


Top
 Profile  
 
PostPosted: Thu Apr 10, 2008 5:38 pm 
Offline
Site Administrator
User avatar

Joined: Tue Sep 09, 2003 6:04 pm
Posts: 14293
Location: Fremont, CA, USA
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group