Re: [phplib] PHPLIB Tree class question From: Alexander Aulbach (ssilk <email protected>)
Date: 01/28/01

On Sun, 28 Jan 2001, Jens Benecke wrote:
}After days of trying to get Spruce_Tree working and not getting anywhere (I
}assume I'm just too stupid - I'd still appreciate help there) I wonder if
}anyone has an idea whether / how the following can be achieved with the
}Tree class in PHPLIB.
}
}
}1) All sublevels should start collapsed.
}
}The result that is to be shown in tree form can easily grow to about 20,000
}elements and I don't want them all expanded. Creating that big an HTML file
}is just plain stupid and then I could just as easily have listed them
}one-dimensionally.
}
}
}2) Only one sublevel should be open at a time.
}
}Same as above. I think Windows help file indexes behave simliarly (but I
}don't know because I don't use Windows). E.g. when the user clicks to
}expand one sublevel all branches that are not parents of that one should
}collapse.

The tree class is just a little helper to move the conceptual "tree as a
graph" into a "tree as a string" - and it is quite old now. I cannot
recommend to use it anymore and I will delete it from CVS.

I reimplemented it within PHPLIBS template-class and works quite good and
is very fast (if the internal tree-struct has been generated).

The problem of making the internal data strukture remains with it, cause I
cannot know, from where the tree-structure comes. It could be a directory
on your harddisk, a part of the structure of a newssystem, the categories
of an adserver.

So the problem of administrating and generating the internal
tree-strukture has been outsourced into the tree_sql-class (which needs
query_sql, which needs db_sql): It can handle a complete tree in a
sql-table. Inserts, updates and selects work very good - and fast. The big
advancment to this class is, that it is able to *read* this table very,
very fast; for any part of this table it needs only one select without a
join - this is cause of a very special design of the table and algorythms
wich ensure to keep the table always in a clean state. Think it is easy to
write a funktion wich creates a query that selects only one element and
all his parents and the root-elements.

For more info please read first phplib-developer list, there I have
written a very big CVS-commit.

If you don't have access to CVS for the actual versions of the files you
can bother me.

-- 

SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>