Tree Menu

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
groovster
Forum Newbie
Posts: 10
Joined: Sun Nov 21, 2004 1:56 pm
Location: Uppsala, Sweden

Tree Menu

Post by groovster »

Hi!

I'm trying to find out how to create a tree menu using mysql database.
I have categories and subcategories.
I want to create a tree menu that the subcategories goes under the category and it shows it self when i click on the category.

Please please someone, HELP MEEE!

:lol:
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

It's all about your database stucture. Once that is right it's easy to build. Then you need to have a couple of variables that keep track of what category and subcategory you are on. Those variables are then past from page to page in a session cookie or in a query string. I've done it once now, but I'm no expert. That's the basic idea of it.

Good luck...
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

http://www.htmldog.com/ptg/archives/000050.php is one method of display. Once you have the menu path set up in the db. A couple of methods are described here: http://www.sitepoint.com/print/1105
groovster
Forum Newbie
Posts: 10
Joined: Sun Nov 21, 2004 1:56 pm
Location: Uppsala, Sweden

Nope

Post by groovster »

This did not solve my problem. Let med show you an example:

I have my Monitor for sale and it is a 17" CRT monitor. In the database it looks like this:

Category Monitor
Subcat CRT
Item 19" Samsung

On my tree menu i want to see the Category first. When i click on it the subcategory displayes and on click on the CRT I want it to show the item in that subcat.

THX
Groovster
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I have posted multiple times on ways to create a tree.. please search.
Post Reply