The following statements

                   ListFirst:[#dircount1.type#]#ListFirst(temp)#<br>
                   ListLast: [#dircount1.type#]#ListLast(temp)#

are in a <cfoutput> with no query parameter, and outside of the <cfloop>.
Therefore they will both refer to the value of type in the first record of
the query dircount. (that's why they both showed dir even though the last
value was a file)

I haven't plowed through all your more recent code, but does this help?

Sheila Handler
jdt technologies, ltd.


==================================
You wrote:
 For some reason the code below lists the last file in the listing as a
 directory even though it is a file?

 Try it out. Make sure you have some text files in your root directory.

 <cfparam name="dir" default="d:\">

 <cfoutput>
<CFDIRECTORY ACTION="LIST" DIRECTORY="#dir#" NAME="test">

<cfset testCount = 0>
<cfloop query="test">
<cfset temp = ValueList(test.name)>
<cfif type eq "Dir">
           <cfset testCount = testCount + 1>
  Count: [#test.type#][#testCount#]<br>
     </cfif>
</cfloop>

  ListFirst: [#test.type#]#ListFirst(temp)#<br>
  ListLast: [#test.type#]#ListLast(temp)#
</cfoutput>


This is my output:

Count: [Dir][1]
Count: [Dir][2]
Count: [Dir][3]
Count: [Dir][4]
Count: [Dir][5]
Count: [Dir][6]
Count: [Dir][7]
Count: [Dir][8]
ListFirst:[Dir] books
ListLast: [Dir] filename.txt

Note the file type on the ListLast output??

It *should* read LstLast: [File] filename.txt

What am I doing wrong?





Hi Craig,

Your code worked great. I'm still having trouble incorporating the code
into the DIRLIST query. It ALWAYS returns the value "8".
I need the directories in the DIRLINK query to increment so I can can check
against the previous loop (dircount1) and set the appropriate graphic for
the first entry, remaining entries and last entry simulating an Explorer
like menu.

First entry graphic would be a closing plus with bottom rule. (dir1)
Remaining entries would be an open plus with rules top/bottom. (dir2 to
dir7)
Last entry graphic would be a closing plus with top rule. (dir8)

I'm not sure I'm making sense. :-)

This is the output from the code below.

Count: [Dir][1] [dir1]
Count: [Dir][2] [dir2]
Count: [Dir][3] [dir3]
Count: [Dir][4] [dir4]
Count: [Dir][5] [dir5]
Count: [Dir][6] [dir6]
Count: [Dir][7] [dir7]
Count: [Dir][8] [dir8]
ListFirst:[Dir]dir1
ListLast: [Dir]dir8

dir1
dir2
dir3
dir4
dir5
dir6
dir7
dir8



Below is is your snippet along with my <CFDIRECTORY


<!--- set indent --->
<cfset indent = "&nbsp;&nbsp;&nbsp;">

<html>

<head>
         <meta http-equiv="content-type"
content="text/html;charset=iso-8859-1">
         <title>N</title>

</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" link="#0000FF" vlink="#0000FF"
alink="#0000FF">

<cfparam name="dir" default="d:\">

<cfoutput>
<cfdirectory action="list" directory="#dir#" name="dircount1">

<cfset loopCount1 = 0>
<cfset temp = "">
<cfloop query="dircount1">
         <cfif type eq "Dir" and  not ( name is "." or name is ".." )>
         <cfset temp = listappend(temp,#name#)>
            <cfset loopCount1 = loopCount1 + 1>
                   Count: [#dircount1.type#][#loopCount1#] [#name#]<br>
      </cfif>
</cfloop>
                   ListFirst:[#dircount1.type#]#ListFirst(temp)#<br>
                   ListLast: [#dircount1.type#]#ListLast(temp)#
</cfoutput>

<cfform action="test2.cfm" method="GET" name="form4">

<cfoutput>
<cfdirectory action="LIST" directory="#dir#" name="dirlist">
</cfoutput>

<!--- Directory Listing --->
<cfoutput query="dirlist">
         <cfif type eq "Dir">
                 <cfif left(name,1) neq ".">
                         <cfif dirlist.name is not "misc" and
                                   dirlist.name is not "RECYCLER">
                                         <table border="0" cellpadding="0"
cellspacing="0" width="100%" height="20">
                                                 <tr height="20">
                                                         <td>#indent#</td>
                                                         <td valign="top"
width="17" height="20"><img valign="top" src="images/plus_notlast.gif"
width="17" height="20" border="0"></td>
                                                         <td
valign="bottom" width="16" height="13">
                                                         <img
src="images/folder-closed.gif" border="0">&nbsp;</td>
                                                         <td
valign="middle" width="100%" height="20">
                                                         <b></b><a
href="#cgi.script_name#?dir=#URLEncodedFormat(dir)##URLEncodedFormat(name)#\
"
class="dirlinks" alt="#name#">
                                                         #name#
                                                         </a></td>
                                                 </tr>
                                         </table>
                         </cfif>
                 </cfif>
         </cfif>
</cfoutput>

</cfform>

</body>

</html>







FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to