Create php tree view

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
denis
Forum Newbie
Posts: 2
Joined: Fri Jul 20, 2007 3:03 pm

Create php tree view

Post by denis »

i have a list of urls contained in a text file like this
Code:

Code: Select all

http://www.example.com/images/yes/en.gif
http://www.example.com/images/yes/de.gif
http://www.example.com/images/yes/fr.gif
http://www.example.com/images/no/en.gif
http://www.example.com/images/no/fr.gif
http://www.example.com/images/ummm/en.gif
from that text file i would like to create a tree view that shows the path from the root like so:
Code:

Code: Select all

images
|--yes
|    |--en.gif
|    |--en.gif
|    |--en.gif
|--no
|    |--en.gif
|    |--f.gif
|--ummm
     |--en.gif
does anyone have any insight on how i could do that?
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post by Chalks »

I would check out

fopen()
fscanf()
fclose()

Then I would use regex to evaluate each line using

preg_match()
preg_replace()
preg_split()


more about regex Here.
denis
Forum Newbie
Posts: 2
Joined: Fri Jul 20, 2007 3:03 pm

Post by denis »

Yes i tried regex but "yes" and "no" displays multiple.
Can please somebody help me
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

post what you have tried
Post Reply