Skript problem / display in 3 rows

Discussion in 'ASP General' started by Guest, Jul 27, 2003.

  1. Guest

    Guest Guest

    Hi,
    if a problem wiht the folowing script. i would like to diplay the results in tree rows, and i have no idea where to do this in the script. I would be very glad if someone can help me....

    ____________________________________________
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


    <%


    Dim strThisPage
    strThisPage = Request.ServerVariables("SCRIPT_NAME")
    strThisPage = Right(strThisPage, Len(strThisPage) - 1)

    ''Path To Folder That holds Files To Download Here
    ''Default is the current Folder
    FILE_FOLDER = StripFileName(Request.ServerVariables("PATH_TRANSLATED"))

    file_path ="72dpi/aussen/"
    file_path300 ="300dpi/aussen/"

    FILE_FOLDER = FILE_FOLDER & file_path




    ''Constants
    Const adVarChar = 200
    Const adInteger = 3
    Const adDate = 7
    Const adFileTime = 64
    Const adNumeric = 131

    %>
    <HTML>
    <HEAD>
    <TITLE>Pressefotos</TITLE>


    </HEAD>

    <BODY >
    <TABLE BORDER=1 ID=tblFileData >

    <%
    strSortHeader = Request.QueryString("sort")

    IF strSortHeader = "" Then
    Call GetAllFiles("")
    Else
    Call GetAllFiles(strSortHeader)
    End IF
    %>


    </TABLE>
    </BODY>
    </HTML>
    <%



    Sub GetAllFiles(strSortBy)
    Dim oFS, oFolder, oFile
    Set oFS = Server.CreateObject("Scripting.FileSystemObject")

    ''Set Folder Object To Proper File Directory
    Set oFolder = oFS.getFolder(FILE_FOLDER)

    Dim intCounter

    intCounter = 0

    IF strSortBy = "" Then ''UnSorted (default)
    Dim FileArray()
    ReDim Preserve FileArray(oFolder.Files.Count, 5)

    For Each oFile in oFolder.Files
    strFileName = oFile.Name
    strFileType = oFile.Type
    strFileSize = oFile.Size
    strFilePath = oFile.Path
    strFileDtMod = oFile.DateLastModified
    Image_Path = Server.URLEncode(Server.MapPath(file_path) &"\" & strfilename )

    FileArray(intCounter, 0) = strFileName


    FileArray(intCounter, 1) = "<a href=" & FILE_path & strfilename & " target=new > <img src=sendbinary.asp?image_path=" & image_path & _
    "> </A>" & "<br><center>" _
    & "<A HREF=''Download2.asp?pathtest=" & file_path & "&filetest=" & strfilename &"'' ><img src=download72dpi_w.gif>" _
    & "<A HREF=''Download2.asp?pathtest=" & file_path300 & "&filetest=" & strfilename &"'' ><img src=download300dpi_w.gif></center>"

    intCounter = (intCounter +1)

    Next

    intRows = uBound(FileArray, 1)
    intCols = uBound(FileArray, 2)

    For x = 0 To intRows -1
    Echo("<Tr>")
    For z = 0 To intCols

    If z > 0 Then
    BuildTableCol(FileArray(x, z))
    End IF

    Next
    Echo("</Tr>")
    Next

    Else
    ''Sorted List

    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Fields.Append "Name", adVarChar, 500
    oRS.Fields.Append "Type", adVarChar, 500
    oRS.Fields.Append "Size", adInteger
    oRS.Fields.Append "Path", adVarChar, 500
    oRS.Fields.Append "Date", adFileTime
    oRS.Open

    For Each oFile in oFolder.Files
    strFileName = oFile.Name
    strFileType = oFile.Type
    strFileSize = oFile.Size
    strFilePath = oFile.Path
    strFileDtMod = oFile.DateLastModified

    oRS.AddNew
    oRS.Fields("Name").Value = "<img src=" & strFilePath & strFileName & ">""<A HREF=" & Chr(34) & "startDownload.asp?File=" _
    & Server.urlEncode(strFilePath) & "&Name=" & Server.urlEncode(strFileName) & "&Size=" & strFileSize & Chr(34) _
    & " onMouseOver=" & Chr(34) & "self.status=''" & strFileName & "''; return true;" & Chr(34) _
    & " onMouseOut=" & Chr(34) & "self.status=''''; return true;" & Chr(34) & ">" & strFileName & "</A>"
    oRS.Fields("Type").Value = strFileType
    oRS.Fields("Size").Value = strFileSize
    oRS.Fields("Path").Value = strFilePath
    oRS.Fields("Date").Value = strFileDtMod
    Next

    oRS.Sort = strSortBy & " ASC"

    Do While Not oRS.EOF
    Echo("<TR>")
    BuildTableCol(oRS("Name"))
    BuildTableCol(oRS("Type"))
    BuildTableCol(oRS("Size"))
    BuildTableCol(oRS("Path"))
    BuildTableCol(oRS("Date"))
    Echo("</TR>")


    oRS.MoveNext
    Loop

    oRS.Close
    Set oRS = Nothing
    End IF

    EchoB("<B>" & oFolder.Files.Count & " Files Available</B>")

    Cleanup oFile
    Cleanup oFolder
    Cleanup oFS
    End Sub

    Function Echo(str)
    Echo = Response.Write(str & vbCrLf)
    End Function

    Function EchoB(str)
    EchoB = Response.Write(str & "<BR>" & vbCrLf)
    End Function

    Sub Cleanup(obj)
    IF isObject(obj) Then
    Set obj = Nothing
    End IF
    End Sub

    Function StripFileName(strFile)
    StripFileName = Left(strFile, inStrRev(strFile, "\"))
    End Function

    Sub BuildTableCol(strData)
    Echo("<TD CLASS=DataCol>" & strData & "</TD>")

    End Sub

    ''Not implemented
    Sub BuildTableRow(arrData)
    Dim intCols
    intCols = uBound(arrData)
    For y = 0 To intCols
    Echo("<TD CLASS=DataCol>" & arrData(y) & "</TD>")
    Next
    End Sub

    %>
    __________________________________

    thaks for helping .... :)

    -----------------------------
    This message is posted by http://Asp.ForumsZone.com
     
    Guest, Jul 27, 2003
    #1
    1. Advertising

  2. Guest

    Bullschmidt Guest

    Perhaps end and start a new row when I MOD 3 is 0 or something
    similar...

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Bullschmidt, Jul 30, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,242
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  2. helpful sql
    Replies:
    0
    Views:
    819
    helpful sql
    May 19, 2005
  3. schwerdy
    Replies:
    2
    Views:
    348
    schwerdy
    Oct 27, 2003
  4. Replies:
    0
    Views:
    101
  5. Replies:
    1
    Views:
    78
    Anno Siegel
    Feb 21, 2006
Loading...

Share This Page