You're right, it gets messy very quickly. The big drawback 
is lots of queries. If you're five or six levels "deep", 
your page will take five or six queries to figure out the 
path back to the root. This might not be what you want if 
you're aiming for performance. Of course, if you cache the 
queries, you could be in luck.

I implemented it once using CFLOOP. Inside the loop is a 
CFQUERY that fetches the next level up, and stores its data 
into an array. Keep looping until the "next level up" has 
the ID of zero, which means you've reached the top. The top 
level record has a parent of zero.

I've wanted to go back and convert it to the nested tree 
model, but haven't gotten around to it :)

If you need more detailed info, i can dig up the code.

Norman

Quoting Michael Lugassy <[EMAIL PROTECTED]>:

> Let's say I'm using the second (following)
> alternative:
> 
> CATEGORIES:
> catID
> parentCat
> catName
> 
> SITES:
> siteID
> siteName
> catID (FK)
> 
> and I want to display a tree of categories, based on
> a catID from sites
> how can I SQL-SELECT recursivley, all the relevent
> catNAMES?
> 
> Sounds pretty messy...
> 
> Michael.
> 
> ----- Original Message -----
> From: "Philip Arnold - ASP" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, July 23, 2001 9:13 PM
> Subject: RE: Me Vs. Complexed Table Design
> 
> 
> > > I didn't find secretagents' tutorial,
> >
> > That's because it's Secret <g>
> >
> > Actually, it's here
> > http://www.secretagents.com/tools/freeviewlets/
> > (You Still Have Time To Learn, Free Online
> Training)
> >
> > or here
> > http://www.secretagents.com/tools/viewlets/
> > (You Still Have Time To Learn, Professional Online
> Tutorials)
> >
> > Philip Arnold
> > Director
> > Certified ColdFusion Developer
> > ASP Multimedia Limited
> > T: +44 (0)20 8680 1133
> >
> > "Websites for the real world"
> >
> >
> 
************************************************************
**********
> > This email and any files transmitted with it are
> confidential and
> > intended solely for the use of the individual or
> entity to whom they
> > are addressed. If you have received this email in
> error please notify
> > the system manager.
> >
> 
************************************************************
**********
> >
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to