Hello. I am trying ot make a menu for a web page that is built from the folder structure on the server. I have go the basics working, but have 2 questions.
1) Can this code be cleaned up?
Within the current folder, I need to build a list of folders, files, subfolders, subfolder files, and check if the subfolders contain more subfolders or if they are the last level. Can this be done directly with FSO or do I need to keep repathing a variable (like MSubFolders above)?
2) is there a way to handle '&' in the folder name? I tried
to replace both ampersands and blank spaces, but it wouldn't work. Any ides?
Thanks for looking this over!
1) Can this code be cleaned up?
Code:
<%
for each FolderIndex in MSubfolders
'create menu items for all folders that do not start with an underscore
if Left(FolderIndex.name,1) <> "_" Then
response.write ("<li><a class='qmparent' href=" & (HOME) & "?loc=/intranet/" & Replace ((FolderIndex.name)," ","%20") & "/>" & (FolderIndex.name) & "</a>")
MSubpath = Server.MapPath(FolderIndex.name)
MSubfolder = FSO.GetFolder(MSubpath)
MSubfolders = MSubfolder.SubFolders
if (MSubfolders.count > 1) then
response.write("<ul>")
for each MSubfolderIndex in MSubfolders
if Left(MSubfolderIndex.name,1) <>"_" Then
response.write("<li><a href=" & (HOME) & "?loc=/intranet/" & Replace((FolderIndex.name)," ","%20") & "/" & Replace(Replace(MSubfolderIndex.name," ","%20"),"&","&") & "/>" & (MSubfolderIndex.name) & "</a></li>")
End If
next
response.write("</ul>")
End If
MSubfolders = nothing
response.write ("</li>")
End If
next
MSubolders = nothing
%>
2) is there a way to handle '&' in the folder name? I tried
Code:
Replace(Replace((FolderIndex.name)," ","%20"),"&","&")
Thanks for looking this over!
Comment