I'm using an object to keep track of items in a hierarchical menu, like this:
Code: Select all
class menu
{
var $nodes;
function addbranch()
{
....
}
}Now $nodes should hold information about title and an array for subnotes. By now I'm holding these in another class like this:
Code: Select all
class node
{
var $title;
var $nodes;
}Is this the best way to do it? I like the readability, but is there other ways to do the same having for example in just one class? Or faster?
Or does anyone maybe know a class outthere somewhere, which will be a good foundation for turning my database information in to a HTML-list? (I'm using the adjacency list model for storing the items hierachical)...
Any suggestions highly appriciated.
/Asger