Learning Resources Center <%
Dim fullPath, lenPath, StartSpot, mainDoc
mainDoc = "Home" 'What do you wish to call the default home page?
fullPath = Replace(Request.ServerVariables("Path_Info"),"index.asp","") ' This is the current full URL
'path, excluding the default document
lenPath = Len(fullPath)
fullPath = Mid(fullPath,2,LenPath) 'Here we just snip the
'leading / away.
lenPath = (lenPath -1) ' because we just snipped the above char.
StartSpot = 1 'This is where we start looking.
'StartSpot is updated as we go on.
'If the page is some other than the main page "/index.asp",
'display link to it.
If fullPath <> "" Then _
Response.Write "" & mainDoc _
& " | "
'This loop is the actual script that parses the current URL.
Dim i, dotA, endSpot, partDirPath, wholeDirPath
For i = 1 to lenPath
dotA = Mid(fullPath,i,1)
If dotA = "/" Then ' Found first start character
EndSpot = i 'Mark the end
partDirPath = _
Mid(fullPath,startSpot,endSpot-(startSpot-1))
wholeDirPath = wholeDirPath & partDirPath
Response.Write "" & _
Replace(partDirPath,"/","") _
& " | "
StartSpot = (i+1) 'Set new starting
'character, which is next to current.
End If
Next
%>
|
|