Jump to content

how to create category => subcategories => posts


Recommended Posts

You'll have to be a lot more specific. What exactly do you not understand?

 

The basic structure should be obvious: There are categories, and there are posts. A category has a parent (which may be NULL for root categories), and a post belongs to one (or more?) categories. There's really nothing special.

 

Note that if the number of subcategory levels isn't limited, fetching the category tree with MySQL will be a pain in the ass (since MySQL doesn't support recursive queries). But you can worry about that later.

ok let me be more specific

 

 

something like this url i am trying to acheive

 

1.   category.php?name=shoes (this display all data from category shoes)

      category.php?name=watches (this display all data from category watechs)

 

2.   category.php?name=shoes&area=casual (this display all data from casuals related to cat name shoes)

      category.php?name=shoes&area=watches (this display all data from casuals related to cat name watches)

 

and lastly the product information display in some php file  how do i plan this structure?

So a product belongs to one category (or many categories?), and each category can be further divided into subsections like “casual”?

 

If the “area” is really just an attribute of a product, I'd make three tables: categories, attributes (or areas) and products. Then you assign each product to one category and one attribute. If you need multiple categories or attributes, you need more tables.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.