Need help replicating directory structure with ColdFusion and jsTree
Posted
by Derek
on Stack Overflow
See other posts from Stack Overflow
or by Derek
Published on 2010-04-28T16:34:44Z
Indexed on
2010/04/28
16:43 UTC
Read the original article
Hit count: 785
I am using this new jQuery plugin called jsTree www.jstree.com and using the HTML datasource.
I am also using ColdFusion 7 with cfdirectory and filtering out files, so just dirs.
I need to recreate the directory structure in the image, well any dir structure I give it actually. I am having a heck of a time with the logic.
variables.imageDirectoriesLen = 8 in this scenario cause I am outputting from the middle of the actual file path, not from begining.
Thanks for the help.
Derek
this is what I have so far
<cfoutput query="clientImageDirsFilter">
<cfset nextLen = 0 />
<cfset nextDir = "" />
<cfset nextRowCnt = currentRow+1 />
<cfset nextDir = clientImageDirsFilter.directory[nextRowCnt] & "\" & clientImageDirsFilter.name[nextRowCnt] />
<cfset nextLen = listLen(nextDir, "\") />
<cfset currLen = listLen(clientImageDirsFilter.directory & "\" & clientImageDirsFilter.name,"\") />
<cfif currLen eq nextLen>
<li rel="folder" id="node_#randRange(1,99999)#"><a href="##"><ins> </ins>#clientImageDirsFilter.name#</a></li>
<cfelseif nextLen lt currLen>
<cfif nextLen eq 0>
#repeatString("</li></ul>",(currLen-nextLen-variables.imageDirectoriesLen))#
</cfif>
<cfelse>
<ul>
<li rel="folder" id="node_#randRange(1,99999)#"><a href="##"><ins> </ins>#clientImageDirsFilter.name#</a>
<ul>
</cfif>
© Stack Overflow or respective owner