 |
|
 |
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: HTML-based Cataloguer?
This may help... Can't debug really, since XP Home doesn't have IIS... But it does do a directory.
A style sheet was used with the following relevant to the code:
#Indent10 { text-indent: 10px; }
#indent20 { text-indent: 20px; }
#Indent30 { text-indent: 30px; }
#Indent40 { text-indent: 40px; }
#indent50 { text-indent: 50px; }
#Indent60 { text-indent: 60px; }
<%
Dim sDir
Dim tmp
Dim OffSet
sDir=Request.ServerVariables("APPL_PHYSICAL_PATH")
tmp = sDir
If Right(tmp,1)="" Then OffSet=1 Else OffSet=0
If InStr(1,tmp,"")>0 Then
For i=len(tmp)-OffSet to 0 Step -1
If Mid(tmp,i,1) ="" Then
tmp=Mid(tmp,i+1,len(tmp))
i=0
End If
Next
End If
Disp "<ui><li id=""indent10""><b>" & tmp & "</b></li></ui>"
If Request.ServerVariables("Logon_User") <> "" Then
Walkthrough sDir, 20
Else
Disp "<ui><li id=""indent10"">Unable to display directory listing without being logged in.</li></ui>"
End IF
%>
<%
Sub Walkthrough(dirname, Indent)
On Error Resume next
Dim MyDirectory
Dim MyFiles
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set MyFiles=MyDirectory.GetFolder(dirname)
If Err.Description <> "" Then
err.clear
dirname = replace(dirname, "help", "inc/help")
Set MyFiles=MyDirectory.GetFolder(dirname)
End If
' Display Files
For each filefound in MyFiles.files
Disp "<ui><li id=""Indent" & Indent &""">" & filefound.Name & "</li></li></ui>"
Next
' Run routine for all directories
For each filefound in MyFiles.SubFolders
If filefound.Name <> dirname Then
Disp "<ui><li id=""Indent20""><b>" & Filefound.Name & "</b></li></ui>"
WalkThrough Request.ServerVariables("APPL_PHYSICAL_PATH") & filefound.Name, 30
End If
Next
End Sub
%>
____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
|
|
25-01-2003 at 09:50 PM |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: HTML-based Cataloguer?
Oops... the asp website I created was highly modular...
<%
' Function to Format HTML Codes, Takes value and adds <ENTER>
Function Disp(Code)
Response.Write Code & Chr(13)
End Function
%>
____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
|
|
26-01-2003 at 01:46 AM |
|
|
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: HTML-based Cataloguer?
of course, this code will work granting that you can use the fso object in your site...
<%
Dim fso, folder, file, path, dq
dq = Chr(34) ' double quote
Set fso = Server.CreateObject("Scripting.FileSystemObject")
path = Server.MapPath("foldername")
Set folder = fso.GetFolder(path)
For Each file In folder.Files
Response.Write "<a href=" & dq & file.Path & dq & ">" & _
file.Name & "</a><br>" & vbCrLf
Next
%> |
i think that JL's code works with a better interface for the user, but i believe this code also gets the job done.
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
26-01-2003 at 12:24 PM |
|
|
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: HTML-based Cataloguer?
this is what i've been able to gather:
IIS has the Personal Web Manager found in Control Panel under Administrative Tools. Run that and under the Advanced button you can create the virtual folder and the directory it points to. not sure if that will work. you may also have to have write permission to write to the directory as well (write permissions can get quite annoying sometimes).
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
27-01-2003 at 05:19 PM |
|
|
|
|
 |
 |