[thelist] .asp "if pagename [this]..."

Maximillian Schwanekamp anaxamaxan at neptunewebworks.com
Wed May 26 23:44:07 CDT 2004


--------------------------------
I've set up my
navigation inside of include files, and I'm really not wanting to change
this, so I'm wondering if there's a way to say:
<% If pagename is [current pagename]
Then style = [LI style2]
Else
Style = [LI style1] %>
--------------------------------

I am guessing you're talking "classic" ASP not .NET.  Also guessing that
you're not using a database to establish the pagename var. So: you can use
the ServerVariables collection of the Request object for this[1].  For
example you have www.example.com/home/blah.asp which has include file
/inc/nav.inc.asp, which has the statement Response.Write
Request.ServerVariables("SCRIPT_NAME").  If you request blah.asp with your
browser, the output will be "/home/blah.asp" - i.e. the name of the running
script.

I imagine the MS gurus on the list will give more details... oh, too late,
Ken already gave an msdn link. :)

[1]
http://www.devguru.com/Technologies/asp/quickref/request_servervariables.htm
l

Maximillian Von Schwanekamp
Dynamic Websites and E-Commerce
www.NeptuneWebworks.com
voice: 541-302-1438
fax: 208-730-6504





More information about the thelist mailing list