Francisco

If the depth of the tree is not changing all the time (the categories 
are relatively static) and you have a reasonable depth (say 5-10 
levels) you can use another approach:

   do one massive SQL query which returns the entire tree expanded to all
   levels

   iterate over the query and create your menu tree

You have to know the depth of the tree to do this, but that's not too 
hard to track.

I am doing this with a set of 256 categories (will grow to probably 
1,000 max) to a depth of 5.

Works well.... The SQL Query is fast, as is the CF code to build the menu tree

The most time was spent downloading the tree to the visitor's browser.


I resolved this in two ways:

    Download only once into a hidden frame when the first page is served

    Created a very compact datastream (1 large variable) with CF.  This gets
    downloaded to the browser (as fast as possible).  At the browser I use
    JavaScript to  iterate over the datastream and create the menu tree in a
    single array

HTH

Dick



At 9:54 AM +0200 7/14/2000, Francisco Montes; Spain on Line wrote:
>Thanks Chris.
>
>The number of queries in my case is a bit high and takes about 5 seconds to
>build up the whole tree. Over a network it could take longer. I was
>wondering if i could make one big query at the beginning and put the content
>in an array and from there, just work with the array all the time. However
>when we (recursively) call MyMakeTree again... we could not pass the whole
>array for it to be processed again could we? :-(
>
>If we try to display everything the cost in number of queries and processing
>time begins to be a bit high. Maybe a partial solution (like refreshing the
>template everytime we click on a category) will make more sense. Hmmm....
>
>
>-----Mensaje original-----
>De: Chris Montgomery <[EMAIL PROTECTED]>
>Para: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>Fecha: viernes 14 de julio de 2000 7:53
>Asunto: RE: Categories tree
>
>
>>Francisco,
>>
>>There is an article on recursion at the Defusion site
>>(http://www.defusion.com/articles/index.cfm?ArticleID=63) that might
>>help.
>>
>>Chris Montgomery             [EMAIL PROTECTED]
>>
>>Web Development & Consulting http://www.astutia.com
>>Allaire Consulting Partner & NetObjects Reseller
>>210-490-3249/888-745-7603    Fax 210-490-4692
>>Find a Job in San Antonio    http://www.sajobnet.com
>>
>>
>>>-----Original Message-----
>>>From: Francisco Montes; Spain on Line [mailto:[EMAIL PROTECTED]]
>>>Sent: Thursday, July 13, 2000 1:06 PM
>>>To: [EMAIL PROTECTED]
>>>Subject: Categories tree
>>>
>>
>>>Hi all,
>>>
>>>I don=B4t know if it=B4s just me or this is quite tricky. All
>>>i want to =
>>>do is what CFtree does but without using an applet do it.
>>>I=B4ve got a =
>>>set of categories and subcategories. Unfortunately the depth
>>>of the tree =
>>>is not fixed so basically we can add categories under a
>>>certain category =
>>>forever.
>>>
>>>I=B4m not aware of any single piece of CF code that uses recursive =
>>>principles to achieve tasks. Tried to use a looping version of what i =
>>>need instead but i just can=B4t come up with a solution to retrieve =
>>>information no matter the depth of the category tree (yes,
>>>it=B4s been a =
>>>really bad day for me today). I=B4ve already got the code for
>>>creating a =
>>>nice dhtml tree but i just can=B4t find the way or sequence i need to =
>>>generate the whole block of code. Something following a secuence like:
>>>
>>>     Branch - Category 1
>>>         Leaf - Category 2
>>>         Leaf - Category 3
>>>         Branch - Category 4
>>>             Leaf - Category 5
>>>             Branch - Category 6
>>>                 Leaf - Category 7
>>>             Leaf - Category 8
>>>
>>>... etc.
>>>
>>>Any ideas?
>>>
>>>TIA
>>>
>>>Francisco Montes
>>>
>>>
>>
>>---------------------------------------------------------------------------
>---
>>Archives: http://www.mail-archive.com/[email protected]/
>>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>
>------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal 
>k or send a message to [EMAIL PROTECTED] with 
>'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to