Page 1 of 1

Create php tree view

Posted: Fri Jul 20, 2007 3:09 pm
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?

Posted: Fri Jul 20, 2007 3:22 pm
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.

Posted: Fri Jul 20, 2007 4:56 pm
by denis
Yes i tried regex but "yes" and "no" displays multiple.
Can please somebody help me

Posted: Fri Jul 20, 2007 10:13 pm
by John Cartwright
post what you have tried