Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

common header but change depending on url

Status
Not open for further replies.

rufc

Programmer
Nov 20, 2001
47
GB
I have an include as the header which is referenced on each page, however I now want to add a new row of navigation depending on which page I am in. Is this possible?

Here's the page
So say if I go into the art gallery page, another row appears under the top navigation giving further options.

Can I do this whilst keeping one header include?

thanks
 
It's easy.
I don't know ASP but it should be simple to just check the file name/request uri/document uri etc and display the navigation based on that.

If you are using SSI then something like the following will work:

<!--#if expr="$DOCUMENT_URI = 'Gallery.asp'" -->
Gallery navigation here
<!--#else -->
Normal navigation here
<!--#endif -->

make sense?

<!--#sig value=''É'' url='' -->
 
Alternatively (and perhaps better) you can make your SSI header file an executable file:
Code:
<!--#include virtual="/cgi-bin/header.cgi" -->
header.cgi can check the value of $ENV{'DOCUMENT_URI'} to find which page is being displayed and serve up the relevant content.

The advantage of doing it this way is that if you decide to change the rules, you only have to change the script, not every page. I tend to always make my SSI include files executables - even if they're the same on every page - just to allow for future flexibility.

-- Chris Hunt
 
Or in ASP you would append a variable to the link calling the page ex: <a href="mylink.asp?sID=1">

then within your pages you would do something like this:

Code:
<%
sID = Request.Querystring("sID")

Select Case sID
  case "1"
    response.write "<!--#include file="mylinkHeader" -->"
  case "2"
    response.write "<!--#include file="mylinkHeader2" -->
end Select
%>

Good luck!

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top