views:

29

answers:

1

I am redoing the navigation bar that is included several dozen of my site's pages. One of the changes that I want to make is to vary the content that is included, based on the page that the user is on. Thus my plan is basically to have the file that is currently included everywhere act as a selector to decide which actual file(s) to include.

From the my reading of the Apache SSI Specs, I believe I can do this through conditional expressions driving my SSI. Something like:

<!--#if expr="[URI is page1.shtml]" -->
<!--#include virtual="page1contents.shtml" -->
<!--#elif expr="[URI is page2.shtml]" -->
<!--#include virtual="page2contents.shtml" -->
<!--#endif -->

My question, then, is what should go in the [URI is page1] part of that to actually test the condition I'm interested in?

A: 

Found the answer in the details of mod_include:

The below example will print "in foo" if the DOCUMENT_URI is /foo/file.html, "in bar" if it is /bar/file.html and "in neither" otherwise:

<!--#if expr='"$DOCUMENT_URI" = "/foo/file.html"' -->
in foo
<!--#elif expr='"$DOCUMENT_URI" = "/bar/file.html"' -->
in bar
<!--#else -->
in neither
<!--#endif -->
JGB146