hi:
Apologies if this should have gone on the newbies PHP msg list but I thought it needed expert knowledge.
Summary: Need a good example of a linked tree and recursion (I think!?)
I'm trying to build a php based dynamic url manager that builds the
menu from saved .txt files (friends site has php but no mySQL).
Example of divider structure (dots there cos no hard spaces 🙁 ):
tech......-> programming..-> java
........................................->php...........->portals
.............................................................->newsgroups
..............->security
media....->companies.......-> bbc
.........................................-> Channel 4
I'm thinking of storing the data in two text files:
groupID label parentID
1 tech root
2 media root
3 programming 1
4 security 1
5 companies 2
6 java 3
7 php 3
8 bbc 5
9 channel 4 5
10 portals 7
11 newsgroups 7
url Label groupID
www.bbc.co.uk/sport London Footy 8
www.bbc.co.uk/london London Events 8
www.chanel4.com C4 9
I want the dividers on the left, presumably as div's, with different shades of the bg colour
to indicate the 'level' of the dividers eg tech, media etc would be darkestBGcolor, programming, portals etc
would be lighterBGcolor etc. When a divider is clicked it expands/hides it's children. Presumably not too difficult using
css/js etc once the basic structure's parsing(?) properly
In the end I want to be able to add/amend/del capabilities but at the mo' I'll be happy if it just builds the chuffin' menu.
I assume it can be done with some linked-list algorithm and recursion but I've just manged to tie my
brain in knots thus far. Can someone please let me know of any urls that explain these ADT's (?) using php or psuedo
code (or at least well commented code if it's not php) and recursion. please.
Also, if anyone knows the url for some URL Management php code I'd be interested in how others have designed & implemented.
Many thanks.