473,503 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Skript problem / display in 3 rows

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_TRANSL ATED"))

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

Jul 19 '05 #1
2 2449
use tables.
Simply add a counter and when you get to (n) start a new row

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

<in**@kvc-online.de> wrote in message
news:48*************@Asp.ForumsZone.com...
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_TRANSL ATED"))

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

Jul 19 '05 #2
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!
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2163
by: schwerdy | last post by:
Greetings to all Python fans :-) Is it possible to create a skript, that can read from a unix pipe (eg.: "find -type f -name "*.ogg" | myscript.py"), _AND_ interact with the user by waiting for...
32
4119
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is...
9
1966
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
3
10229
by: shreddie | last post by:
Could anyone assist with the following problem? I'm using JavaScript to hide/show table rows depending on the option selected in radio buttons. The script works fine in IE but in Firefox the...
1
3693
by: Laurel | last post by:
Hi, Do you know some browsers that would misbehave with these three lines of CSS code: table.liste tr {display:none;} table.liste tr.headers {display: block;} table.liste tr.headers...
18
3321
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
0
5797
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
2
7035
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
1
4920
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.