/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
Sortering
Fra : Karsten Krambs


Dato : 14-08-03 07:57

Hej,

Nedenstående script lister aller jpg filer i dir og lister dem.

pt listes billeder efter dato (hvilket gør at hvis jeg editere pic46
og gemme på ny, så kommer den sidste i visning) - jeg ville gerne
liste dem sorteret på filnavn. Jeg kan gennemskue at jeg skal have
sorteret objFileItem, Men hvordan.


Karsten Krambs
--
Ba.Sc.Eng (hons) & Stud.Theol
http://stepBstep.dk


===================================================


<head>
<title>PICS</title>
</head>
<body bgcolor="#C0C0C0">
<h3 align="center">PICS</h3>
<hr>

<%

'------------------------------------------------
'Åbner Filsystem
'------------------------------------------------
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files

'------------------------------------------------
'grund variabler
'------------------------------------------------
row_count = 0
row = 1
max_row = 100
count = 1
If NOT start <> "" then
Start = 1
End If
%>

<p align=center>

<%
'------------------------------------------------
'Info variabler
'------------------------------------------------
info_page = 0
info_page_count = 0
info_Count = 0
'------------------------------------------------
'Info Script, udregner og udskriver info til siden
'------------------------------------------------
'If page <> "" then
'response.write "side <a href='default.asp'>1</a> "
'else
'Response.write "side 1 "
'End If

For Each objFileItem in objFolderContents
info_Count = info_Count + 1
info_page = info_page + 1
if info_page = 100 then
info_page_count = info_page_count + 1
info_page = 0
End If
If info_page = 0 then
If trim(info_page_count + 1) = trim(page) then
' response.write info_page_count + 1 & " "
Else
' response.write "<a href='default.asp?start=" & info_count &
"&page=" & info_page_count + 1 & "'>" & info_page_count + 1 & "<a> "
End If
End If
Next

info_Count = info_Count - 2

Response.write "<br>Der er ialt <b>" & (info_Count) & "</b> billeder"
if (info_page_count) * 100 = info_count then
' Response.write " på <b>" & (info_page_count) & "</b> sider<br>"
Else
' Response.write " på <b>" & (info_page_count) + 1 & "</b>
sider<br>"
End If
%>

<div align="center">
<table border="0" cellspacing="2" cellpadding="2">
<tr>

<%
For Each objFileItem in objFolderContents
'------------------------------------------------
' - fil navn til under DIR
'------------------------------------------------
info_new_name = objFileItem.Name
Nr = Len(objFileItem.Name) - 3
trimmed = Mid(info_new_name,4,Nr)
Out = "pic/" + trimmed
Nr = Nr-5
trimmed2 = Mid(trimmed,3,Nr)
trimmed2 = Replace(trimmed2,"_", " ")
trimmed2 = Replace(trimmed2,".", " ")
trimmed2 = replace(trimmed2,"oe", "&oslash;")
trimmed2 = replace(trimmed2,"Oe", "&Oslash;")
trimmed2 = replace(trimmed2,"aa", "&aring;")
trimmed2 = replace(trimmed2,"Aa", "&Aring;")
trimmed2 = replace(trimmed2,"ae", "&aelig;")
trimmed2 = replace(trimmed2,"Ae", "&AElig;")

'info_new_name_alt = objFileItem.Name
'Nrto = Len(objFileItem.Name) - 9
'info_new_name_alt2 = Mid(info_new_name_alt,6,Nrto)
'info_new_name_alt3 = Replace(info_new_name_alt2,"_", VbCr)

If objFileItem.Name = "default.asp" or objFileItem.Name = "page.asp"
or objFileItem.Name = "deefault.asp" then
Else

If CLng(count) < CLng(start) then
count = count + 1
Else

If CLng(row) => CLng(max_row) And row_count = 4 then
Else

If row_count > 3 then
response.write "</td><tr>"
row_count = 0
row = row + 1
End If

Response.write " <td>"
Response.write "<a href= ""#""
onClick=""MyWindow=window.open('page.asp?picnr=" & (out) &
"','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=553,height=435');
return false; target=_blank"" ><img border=0 src='" &
(objFileItem.Name) & "' alt='" & (Trimmed2) & "' width=71
height=53></a></td>"
    row_count = row_count + 1   
count = count + 1
End If
End If
End If
Next
%>

</td>
</tr>
</table>


 
 
Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408527
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste