In article <3B*******************@news02.tsnz.net>, Hayden Kirk wrote:
Hi
I want to make categories on a website, like folders that have a tree to
them...
I was wondering if the best way is to have it in an array and have them all
point to each other and sort them with some sort of algorithm.
I prefer to store that data in database.
I ended up with categories that are able to contain other categories.
The data structure looks like a tree.
If you search the web for a Tree implementation in SQL, i'm pretty sure
you'll get a lot of hits. One of them will be about nested sets.
As soon you understand how that works, you could have a look at the
NestedSets package at
http://pear.php.net
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>