[eluser]roadie[/eluser]
Hi guys!
I have this db structure
categories:
id|name|description|type|parent_id|status //type can be "general" or "business"
articles:
id|title|content|parent_id|status
companies:
id|name|description|content|parent_id|status
What I want to achieve is to show my categories and their children like this:
Category1 (type=general)
Subcat1
Subcat2
Subcat3 => Article1
Article2
Article3
Category2 (type=general)
Article1
Article2
Article3
---------------
CategoryX (type=business)
Subcat1
Subcat2
Subcat3 => Company1
Company2
Company3
I found lots of examples about the recursive method and made it work as long as I don't have two kinds of leafs (Articles, Companies). If the top category is "business", then the leafs will be "companies", if "general" the leafs will be simple "articles".
Should I structure my db in a different way? I have only one "business" top-category, the rest are all "general".
Help is greatly appreciate it!