Nested categories -- create cookie crumb trail?

They have: 140 posts

Joined: Jan 2003

I have a column which is parentid, which references the parent category.

So, id 5's parent may be 4 whose parent is 3 whose parent is 2 whose parent is 1

So, I want to print it out like 1 -> 2 -> 3 -> 4 -> 5(current position)

Of course, i'd like to also display the title field instead of the actual id field..

Kind of like on this site, the:
The Webmaster Forums » Designing and Building your Website » Server-Side Scripting

Any help on how to do this would be appreciated! The only way I can think of is recursive MySQL queries until it gets back to the toplevel category, but that seems like it could really add up to a lot of queries...

Thanks in advance!

SonicMailer Pro
The best mailing list manager has just gotten better!
Click here for a full list of features!

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Drupal has a "taxonomy" feature, which is fairly advanced. If you're building this site from scratch, or porting a site, and are considering a CMS, try Drupal. I can't recall any other specific links, so try hotscripts.com for a pre-made solution.

If you want to contruct this yourself, well, it's a little too complicated to explain in a paragraph... Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.