Hi Metzy,

You should be able to convert your paths into a query or the like
before creating your tree... i.e.

<cfset rstree = querynew("file,parent")>
<cfset queryaddrow(rstree)>
<cfset rstree.file[1] = myfilname>
<cfset rstree.parent[1] = getdirectoryfrompath(myfilename)>

Or perhaps better yet just create the dhtml tree objects in a
structure - once you have a key in the structure for each file, you
can nest them by looping over the structure again, checking for a key
for its parent directory and if it doesn't exist creating it. Using a
recursive function could help in this regard...

function addTree(st,mytree) {
  if (not structkeyexists(st,getdirectoryfrompath(mytree.file))) {
    addTree(st,makeNewTree(mytree.file));
  } st[mytree.file] = mytree;
}

Sorry if this description is a bit muddled... I seem to be falling
asleep at my desk... :-/

> Hello everyone,

> I'm trying to create a tree structure, i'm using
> coldfusion 5 on a unix box. I'm forbidden to use CFTREE
> and parent child relationships. all i have is a pathname
> column that i have to parse out to create a hierarchical
> visual representation of a directory structure. I'm having
> a really difficult time trying to figure out how i'm going
> to accomplish this.
> Also in this table there is no concept of folder, meaning
> a folder exist only if a document exist :(

> the records can look like this
> doc_id     path_name
> file_name
> 1          test1/test1.1
> file1.pdf
> 2          test1/test1.2
> file2.pdf
> 3          test2/
> file3.pdf
> 4          test2/test2.1
> file4.pdf
> 5          test2/test2.1/test2.1.1/
> file5.pdf

> ps. i've found several wonderful examples on alternatives
> to cftree. but nothing so far that parses a pathname.

> Thank you,
> Metzy

s. isaac dealey   954.927.5117

new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework
http://www.sys-con.com/story/?storyid=44477&DE=1
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to