You're correct.  It simply reincludes itself till it no longer finds a
dependency.  I know there are more efficient ways to do it but it works for
this example.

This discussion forces me to revisit.  One day I'll purty it up a bit more
and put it up for download somewhere.  Haven't looked at it for some time.

Emmet



-----Original Message-----
From: Kerry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 26, 2005 12:23 PM
To: CF-Talk
Subject: RE: Recursion anyone?

make that 1 query for every parent, + 1 query for each child of each parent.

-----Original Message-----
From: Emmet McGovern [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:49
To: CF-Talk
Subject: RE: Recursion anyone?


Here's a use of treeview.nets treeview with recursion.
http://fullcitymedia.com/apps/treeview

You can download the code here.
http://fullcitymedia.com/apps/treeview/treeview.zip

Take a look, might be similar to what you're looking for.

Emmet

-----Original Message-----
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 10:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?

Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding </cfscript>. If the body of the tag is empty you can use
the shortcut <cfscript .../>.


This is the exact code....

<cfquery datasource="#DSN#" name="getAllCategories">
SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes
</cfquery>


<cfscript>
variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"<br>");
    buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)
</cfscript>

Steve







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222361
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to