Hi,
I was wondering if someone could help suggest a good format for a category tree that I want to build.
I want to build something like this:-
Vehicles
|-----Cars
|----Sports Cars
|------- Toyota
|--- some car
|--- another car
|------- Ford
|--- another car
|--- another car
|-----Family
|------- Toyota
|--- another car
|--- another car
|--- another car
|--- another car
|---- Boats
etc...
The thing is... each item could, theoretically, be in 3-4 or more subcategories...
How do people typically deal with something like this? How would you go about dynamically displaying the tree? Is there a way to do it so that the tree can be "manipulated" in multiple ways? (eg. in the above, Toyota could've been chosen as a search parameter before Family...)
I've never done any real MySQL/PHP coding before... I just have 20 years of C++ experience...
Thanks for any advice,
Bob
PS. What I currently have is something like this in a .SQL file which I'm going to import through PHPMyAdmin:-
DROP TABLE IF EXISTS `ListingCategory`;
CREATE TABLE IF NOT EXISTS `ListingCategory` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`category_id` int(11) NOT NULL default '0',
`friendly_url` varchar(255) NOT NULL default '',
`keywords` text NOT NULL,
`active_listing` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `friendly_url` (`friendly_url`),
KEY `category_id` (`category_id`),
KEY `title` (`title`),
KEY `active_listing` (`active_listing`),
FULLTEXT KEY `keywords` (`keywords`,`title`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
--
-- Empty Table `ListingCategory`
--
INSERT INTO `ListingCategory` (`id`, `title`, `category_id`, `friendly_url`, `keywords`, `active_listing`) VALUES
(7, 'Test Category 1', 0, 'test_category_1', '', 0),
(8, 'Test Subcategory 1', 7, 'test_subcategory_1', '', 0),
(9, 'Test Category 2', 0, 'test_category_2', '', 0),
(10, 'Test Subcategory 2', 9, 'test_subcategory_2', '', 0);










Bookmarks