Thanks David, I get that:)
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
On Wednesday 26 October 2005 11:15, Stephen Whiteley wrote:
know how to recurse through an adjacency list model table, of the following
setup
ID CategoryName ParentItemID
topLevel=getNodesWithNoParent()
foreach thisNode in topLevel{
print thisNode
getChildren(thisNode)
}
There are loads and loads of DHTML menus out there, e.g.
http://www.dynamicdrive.com/dynamicindex1/hvmenu/
with the actual menu code taken care of, all you have to do is recurse over
your database and write out the menu items.
last time i checked, cftree outputs a java applet, not javascript.
Depending on your DB you may be able to do the recursion there rather
than in the CF or JS code:
http://www.oreilly.com/catalog/sqlpr/chapter/ch01.pdf
On 10/26/05, Stephen Whiteley [EMAIL PROTECTED] wrote:
Hi
I keep returning to this problem in order to build an infinite DHTML menu (a
task
Why not use one of the nice DHTML menus that already exists.
I have built a tag that creates an DHTML explorer tree, and all I do is
query my category's, putitng them in the correct order, then recursively
loop over that query to check for child items of the current node.
--
Russ
-Original
Hi
Yes the problem is the recursion can't get my head round it, never used
CFSCRIPT before being a bit of a newbie.
Not trying to build a DHTML menu from scratch and would use an off the shelf
one.
CFTREE in CFMX 7 will output xml or a structure depending on format= used.
I'll keep playing
OK, this is my database setup
ItemID,ParentItemID,AdCategoryName
What I want to be able to do is output something like this (before I go to the
DHTML menu stage, walk before I can run)
Accommodation
Self Catering
Farmhouse
Rustic Farmhouse
Activities
Walking
Walking Routes
Walking Shops
etc.
--//-
-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 6:11 AM
To: CF-Talk
Subject: Re: Recursion anyone?
Hi
Yes the problem is the recursion can't get my head round it, never used
CFSCRIPT before being a bit of a newbie.
Not trying to build
Kerry
I'm trying to get you code to work but will be making a real hash of it, I
wonder if you take a look at this, I think getting the query in is the problem.
cfquery datasource=#DSN# name=getAllCategories
SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes
/cfquery
cfscript
give you the first record's categoryname.
when doing a for() loop, you _must_ use the counter
variables.menuqry.adcategoryname[i]
Good luck!
-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 14:51
To: CF-Talk
Subject: Re: Recursion anyone?
Kerry
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
-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 9: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
[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
Thanks, missed that
Still throwing an error though
Variable PARENTITEMID is undefined.
The error occurred in C:\Inetpub\wwwroot\bigtripper\recurse\testfunction.cfm:
line 11
9 : function buildmenu(currentid,depth){
10 : var i=0;
11 : for(i=1; i lte parentitemid.menuqry.recordcount;
errors in your code is pushing it.
-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:52
To: CF-Talk
Subject: Re: Recursion anyone?
Thanks, missed that
Still throwing an error though
Variable PARENTITEMID is undefined.
The error occurred in
C
buildmenu(10,0);
/cfscript
-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:30
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
On Wednesday 26 October 2005 16:03, Kerry wrote:
dude, I dont mind helping with the overall how do i do this, but asking
me to debug simple errors in your code is pushing it.
This is why most of the time I will only post pseudo-code, unless there is
some important point the code needs to get
Just had a read of the code, it does 2 queries for every parent in the
database?
Did I read that correctly?
-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
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
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
Hi
Thanks everyone, there's lots of different approaches here which I'll look at
over time. Brain got tired in the end! I just thought that with the new CFTREE
format options i.e. xml and object, that there could be a quick (and easy) way
to do DHTML menus.
But I've learnt quite a bit, sorry
An easy way to do recursion in cf is to use a custom tag. One of the
things you will have to do is have your top level be set to a parent
id that wont get used in any levels below it. I like to set the top
level to zero or one.
The first time you call your custom tag you just pass the top
22 matches
Mail list logo