A Leaf will have exactly 3 ancestors;
Leaf <= Type <= SuperType <= Category
Each category can have multiple SuperTypes, each SuperType can have multiple Types, each Type can have multiple Leaves.
Representing this in the database isnt difficult; parsing it is.
A page will load with a given Category value; I need to retrieve all Leaves that belong to said category; that’s easy.
Now i need to walk the tree in-order. Foreach Supertype…Foreach Type… Foreach Leaf. So i need to determine the best way to establish the database and how to translate it into a walkable tree.
Additional: Leaves have a different data model than any other type (additional values). The other types carry only a Name value.
build your categories table structure as described in the tutorial at the other end of the link I posted. the lft and rgt values for each category (node) represent where each category is in the hierarchy are then used to retrieve, move or delete nodes and their children.
assign lft and rgt values to each category as described in the tutorial.
build an sql query to retrieve the categories you need to display in the browser.
generate the html as you loop through the retrieved categories from 3).
That… told me all of nothing.
“How do I make this walkable?”
“Make it walkable.”
…
simply Looping through the elements doesnt work - you dont get a chance to close tags from 6 elements ago, unless i’m missing something.
If i have to loop through the elements and put them into a tree inside PHP, what precisely have i accomplished by redesigning my table? I have no need to search within the tree itself - the full tree (each Category being a tree) will be pulled every time.