Jump to content

Need Help Understanding the Logic of Multiple Category Selection


PHPFAN10

Recommended Posts

Hi,

 

I decided to build my own CMS. It's like a blog but with groups, users etc.

 

Basically i have been developing it for past day and so far everything is working as expected.

 

Currently when adding a new post to the site i have a dynamic category that displays all categories from database and i then select which category i want they post to appear in.

 

The problem i am having is how do i go about making it so i can select more than one category for the post to display in ?

 

I have searched high and low online for a tutorial that could perhaps explain the concept but so far cannot find anything.

 

Here is my database design as it stands, it will be altered slightly and improved as i add new things etc but at the moment this is the design

 

diagram1.jpg

 

Uploaded with ImageShack.us

 

as you can see i have a categories table and posts aswell as the others tables but wondering if someone could explain the concept on what i would need to do to make it so i can select multiple categories.

 

another concept i don't know how the logic works is, if i delete a category and there are posts in that category what logic would a developer use to keep the post but perhaps place it in another category ?

 

Thanks for any help.

PHPFAN

To make the post display in multiple categories you could do a link table between posts and categories. And to keep the deleted posts/categories in history I see atleast two possible choices. Make a history table for the posts/categories and when they are deleted you move them to these history tables. Or you could add a field to categories/posts e.g called deleted (TINYINT(1)) where 1 indicates that they are deleted and 0 (default) that they are not. Not sure thought if I got what you are after. I could be telling stories.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.