[thelist] ASP question - navigation

Matt Warden mwarden at gmail.com
Fri Oct 29 09:53:54 CDT 2004

On Fri, 29 Oct 2004 06:20:32 -0700 (PDT), Tom Dell'Aringa
<pixelmech at yahoo.com> wrote:
> I can get my path where the page rests:
> /blah/Handbook/Deployment/somepage.asp
> The key think I need to get is "Deployment" out of these URLs - that is the section they are in.
> How in ASP can I test for deployment so I can indicate the correct LI item as current?
> Psuedo code I want is:
> if
>   url contains "Deployment"
> then
>   LI item deployment gets "current" ID
> end if


' find first slash starting at last character and 
' moving right to left
posLastSlash = instrrev(scriptname, "/") - 1

' find slash starting at posLastSlash and 
' moving right to left
iSubstrLen = instrrev(scriptname, "/", posLastSlash)

' extract substring between posLastSlash-iSubstrLen and 
' posLastSlash (posLastSlash-iSubstrLen+iSubstrLen)
section = mid(scriptname, posLastSlash-iSubstrLen, iSubstrLen)

(insert 'if' or 'select case' here, comparing against teh variable 'section')

If you get a slash in the substring or it otherwise isn't working,
it's probably because I subtracted a one where I wasn't supposed to,
or didn't subtract/add a one where I shoudl have. So, try playing
around with that. If you can't get it to work, just let me know and
I'll actually test this out.

Of course, this won't help you at all if your sections aren't
identified by the same section of the url every time.

Matt Warden
Miami University
Oxford, OH

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list