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
denis
Forum Newbie
Posts: 2 Joined: Fri Jul 20, 2007 3:03 pm
Post
by denis » Fri Jul 20, 2007 3:09 pm
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?
Chalks
Forum Contributor
Posts: 447 Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana
Post
by Chalks » Fri Jul 20, 2007 3:22 pm
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 » Fri Jul 20, 2007 4:56 pm
Yes i tried regex but "yes" and "no" displays multiple.
Can please somebody help me