Take a look at the vBulletin table schema for `forum`, and you will notice these columns:
childlist, parentid, parentlist, and forumid.
A hierarchical tree structure of categories composed of subcategories is possible using only the parentid & forumid, as I've done it for a project at my job (this requires a deviously complex recursive function--but only one query), but vBulletin takes an alternative route using supplemental data (parentlist and childlist), which contain the forumids of the parents and children of the current forum).
You can write SQL queries to grab threads and forums from the current forum and all its children easily using childlist. You can go upward, grabbing parent forum data, using the parentlist.
As for categories, that is forums that cannot be posted in (except for their children forums), they are denoted by a parentid of -1.
It's awkard explaining, but it's not very hard to do. The more difficult part that vBulletin places itself at is updating the parentlist and childlist everytime you change a forum into a parent or under another forum.
|