cygnusx197
Programmer
I'm going to try my first site with content from a db with php, and am stuck on how to build the database for my bookmarks.
I guess the folder analagy is pretty accurate.
You can have multiple categories, with multiple subcategories, and more subcategories in those, and yes... another level of subcategories, with no fixed number of tiers.
So for example, programming -> web related -> php -> devshed.com
or
linux -> distros -> redhat -> package managers -> up2date -> howto.html
I know to create a table with main categories (design, programming, hardware, personal, ect.) and assign an id.
I was going to create another table for subcategories, and join them to the parent category by its id, but then I realized that I have several layers of subcategories beneath each of those.
It just doesn't seem very efficient to have a table for every "folder" in my set of bookmarks, and could use a tip or two.
Here's what I'm thinking about now:
bookmark_parents table defines top level categories:
id category
1 design
2 linux
3 programming
4 misc
bookmark_subcategories table defines ALL subcategories, regardless of how many tiers deep they go... like a folder within a folder within a folder within a folder:
id subcategory
1 php
2 perl
3 flash
4 distros
bookmarks table:
id bookmark
1 2 3 4
bookmark_relations
id bookmark parent
1 1 1
2 2 2
3 3 4
4 4 3
I guess the folder analagy is pretty accurate.
You can have multiple categories, with multiple subcategories, and more subcategories in those, and yes... another level of subcategories, with no fixed number of tiers.
So for example, programming -> web related -> php -> devshed.com
or
linux -> distros -> redhat -> package managers -> up2date -> howto.html
I know to create a table with main categories (design, programming, hardware, personal, ect.) and assign an id.
I was going to create another table for subcategories, and join them to the parent category by its id, but then I realized that I have several layers of subcategories beneath each of those.
It just doesn't seem very efficient to have a table for every "folder" in my set of bookmarks, and could use a tip or two.
Here's what I'm thinking about now:
bookmark_parents table defines top level categories:
id category
1 design
2 linux
3 programming
4 misc
bookmark_subcategories table defines ALL subcategories, regardless of how many tiers deep they go... like a folder within a folder within a folder within a folder:
id subcategory
1 php
2 perl
3 flash
4 distros
bookmarks table:
id bookmark
1 2 3 4
bookmark_relations
id bookmark parent
1 1 1
2 2 2
3 3 4
4 4 3