The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
hierarchial system/category and forums sytem
hey well ive been trying to get something like vb's category and forum system to work but i cant can someone explain to me how to accomplish something like a category and then things under it. i have looked at vb's code for forming the forum list and i see its all done in one query, so i was wondering how does it determine what is a category, what is a forum, and how to place them.... can someone please help
|
#2
|
|||
|
|||
In the forum editor it asks if posts can be made in the forum. It states that it will be treated as a category if no. Set it to no and save it. This will then display as a category.
Then when creating forums, set the parent forum to be the one that you have set to be your category. |
#3
|
||||
|
||||
im talking about how the actual functions in /includes/functions_forumlist.php detect/know if its a category and how to group them
|
#4
|
||||
|
||||
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. |
#5
|
||||
|
||||
There are loads of algorithms and methods to generating a hiearachical category tree. The most popular is the method VelocD described above. If you're interested you may want to check out this article which outlines another (pretty useful) method too:
http://www.sitepoint.com/article/hie...-data-database |
#6
|
||||
|
||||
I posed this question on SitePoint back in August when looking for the basic algorithm:
http://www.sitepoint.com/forums/showthread.php?t=186114 The solution I ended using was heavy modifcation of stereofrog's (post#6), which uses only one query and only relies on the parent ID. |
#7
|
||||
|
||||
well i was analyzing that article before and its very confusing. i was wondering which is easier/better to do that way or vb's.
also i was look at vb's code: PHP Code:
also is childlist used at all in actually building the forum list/index? |
#8
|
||||
|
||||
ksorts sorts an array by its keys, so sorting $iforumcache[$parentid] sorts that array by displayorder.
I'm not certain what childlist is for. Maybe in building search indexes or something. vBs way is fine, and probably easier to manipulate in PHP quickly. Less implementation would be using the way I explained in my previous post, since you don't have to rebuild a parentlist whenever a forum is relocated. |
#9
|
||||
|
||||
i was looking at that article and it says the recursion method is slow and query wasting, now the other method tree something seems better. i just wanted to know are there anyother besides recursion, tree, and vb's method to doing this?
and which did u you guys choose? |
#10
|
||||
|
||||
could such a system also be used in a family tree type situation?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|