PDA

View Full Version : how to do categories/subcategories?


N!ck
05-30-2002, 03:53 AM
using mysql and php, how do you do one level of subcategories within categories on a single page, like vBulletin has by default? i'm having trouble figuring out how to do this without a [poooop]load of queries

Admin
05-30-2002, 09:34 AM
Basically you need each record to have a parent field, that tells you what's the item's parent.

Then you load all data from your table into one big array, where the key is the parent field. Then you create a recursive function, that deals with the mentioned array, each time using a different parent.

It can get complicated, check out index.php of vBulletin to learn more. Disregard the parentlist field in the forum table as it's merely used for permissions.