Website navigation & including files...

Associate
Joined
3 Jun 2007
Posts
34
Hey :)

So i'm wondering, usually for microsites I have the one index file and then a few other files for including within the index file, for example...

Code:
<div id="navigation">
 <a href="index.asp?pg=1" <%if pg = 1 then%>class="current"<%end if%>...
 <a href="index.asp?pg=2" <%if pg = 2 then%>class="current"<%end if%>...
</div>

<div id="content">

if pg = 1 then
 <!--#include file="home.asp"-->
elseif pg = 2 then
  <!--#include file="about.asp"-->
end if

</div>

but, what i'd like to do is do it the completey opposite way around, so instead of having an index file and then "home.asp", "about.asp" being loaded into the index file, there would just be "index.asp" and "about.asp", with the navigation div being included into each page.

my question is...

normally i would use a "pg" variable to figure out what page i'm on, in order for applying the correct class for the navigation, but if i don't have this anymore, how do i know what page i'm on, without having to manually re-write the navigation in every file on my website?

thanks :)

steve.
 
Associate
OP
Joined
3 Jun 2007
Posts
34
ah, nevermind, figured it out :)

for anyone who's interested...

Code:
<%
 dim pg
 pg = request.servervariables("script_name")
%>

<a href="index.asp" <%if instr(pg,"/index.asp") > 0 then%>class="current"<%end if%>Home</a>
<a href="about.asp" <%if instr(pg,"/about.asp") > 0 then%>class="current"<%end if%>About</a>
 
Back
Top Bottom