Experts,
I need a CFTree control to show the contents of a folder on the webserver. The structure of this directory is known and is not supposed to change: the root directory will contain no files itself, but will have exactly 1 level of subdirectories, which will have the pertinent files. Is there a way to do this with a single CFDirectory tag, which can be "group by"ed and displayed with a single CFTreeItem tag?
Even if the solution is hardcoded (I'd actually prefer if it can be dynamically recursive to include any number of subdirectory levels, but I'm not picky), I need a CFDirectory query (or series of queries) that I can display with a CFTree. CFTree must be really easy, because there seems to be no need for live, working examples out there. I couldn't find any, at least. Can you retroactively go back and assign a child node to an existing node with the "parent" property? And how does one make the plus-signs appear next to unexpanded folders, along with the dotted lines to the child folders?
In short, I know nothing about CFDirectory, CFTree, or CFFile. I haven't had much time to work on this, so I'd really appreciate your help on this.
Thanks!
RJ
'First Attempt' Source Code:
<cfset thePath = "C:\WebData\Reports">
<cfdirectory name="WebData" action="List" directory="#thePath#" sort="Name ASC">
<cfloop query="WebData"> <!--- attempt to get subdirectories--->
<cfdirectory name="#WebData.Name#" action="List" directory="#thePath#\#WebD
ata.Name#"
>
</cfloop>
<cfform action="getFile_go.cfm" method="POST"> <!--- is this needed for CFTree? --->
<cftree name="treeWebData" appendkey="no">
<cftreeitem value="Name" query="WebData" queryasroot="no" img="folder,document"
imgopen="folder,document" parent="WebData" expand="no">
<cfloop query="WebData"> <!--- create treeitems for subdirectories --->
<cftreeitem value="Name" query="#WebData.Name#" parent="#WebData.Name#"
expand="yes">
</cfloop> <!--- setting the parent property doesn't seem to do anything --->
</cftree>
</cfform>