Forum Moderators: open

Message Too Old, No Replies

Retrieving the value of a page's "parent" directory

Through basic text manipulation

         

Darkelve

1:23 pm on Jul 17, 2006 (gmt 0)

10+ Year Member



I want to retrieve an URL in a string like www.mypage.com/about/ (the string would be 'about') and then applying an 'if' block to it if it matches a certain condition.

See following code I have up to now:


Dim page
page = Request.ServerVariables("url")
Response.write (page) ' for testing

if page="about" Then
Reponse.write("Match Found!") ' for testing - to be replaced with a 'select ... case'-type block
end if

The idea is to apply a custom background-image through CSS (by applying a class or id with associated style), so that visitors can visually see the main section they are in.

Now I'd like to know how I can manipulate the string to capture everything between the first and second 'forward slash' ( / ) and put it in the 'page' variable.

I also know a little bit of Basic (Qbasic, Visual Basic) and I was wondering if VBscript has something like a "Select... case" statement. This would be useful in this case, since there are about 9-12 main navigation links to go through.

Thanks in advance,

Darkelve

Darkelve

10:57 am on Jul 19, 2006 (gmt 0)

10+ Year Member



I finally found a solution... I found a new best friend: the "Split" function :)