<%@ LANGUAGE="VBSCRIPT" %> <% option explicit %> Std-Inhalt-Titel <% 'ZH: Liefert die Beschreibung eines Ordners ' = den Inhalt der Datei description.txt als String Function GetAlbumDescription(sAlbumName) Dim fso Dim oFile GetAlbumDescription = "" 'Ein vernuenftiger Defaultwert Set fso = CreateObject("Scripting.FileSystemObject") 'ForReading .. 1 on error resume next Set oFile = FSO.OpenTextFile(Server.MapPath("alben\" & sAlbumName & "\Description.txt"),1) GetAlbumDescription = oFile.readAll() oFile.close on error goto 0 set oFile = Nothing set FSO = nothing end function 'Liefert auch rekursiv alle Unterverzeichnisse eines Folders 'Das Ergebnis wird im Dictionary-Objekt mit Key:'FullPathName' Wert: 'FullPathName' hinterlegt Sub GetFSOSubDirs(fldr, oSD) Dim subfldr oSD.Add fldr.Path, fldr.Path for each subfldr in fldr.SubFolders Call GetFSOSubDirs(subfldr, oSD) Next End Sub 'ZH: So nun muessen wir zunächst mal schaun, wieviele Photoalben es gibt 'und einfach für jedes Album einen Eintrag ausgeben Dim fso Dim fldr Dim arrItems Dim sComboPath Dim arrFolderItems(100) Dim oSDAllPicFolders Dim sPicturePath Dim sPicturePathPre Dim oSubfldr Dim sDescription Dim oFile Set fso = CreateObject("Scripting.FileSystemObject") 'Um die Verzeichnisse zu hinterlegen, reservieren wir uns 'ein Dictionary-Objekt ' Set oSDAllPicFolders = CreateObject("Scripting.Dictionary") Set fldr = fso.GetFolder(Server.MapPath("alben")) for each oSubfldr in fldr.SubFolders response.write "" next %>
" & oSubfldr.name & "" & GetAlbumDescription(oSubfldr.name) & "