[thelist] Menus and SSIs

David Kaufman david at gigawatt.com
Thu Mar 9 14:37:37 CST 2006


Hi Anonymous & Ricky, 

Ricky Zhou <ricky.zhou at gmail.com> wrote:
>
> On 3/9/06, Anonymous <junkmail at lostcreektech.com> wrote:
>> Currently doing some work on a website and using SSI for the nav
>> menu. Currently all the pages except one have the same menu. The one
>> oddball has some extra links. Is it possible using the IF/THEN/ELSE
>> functions of Apache includes to check the file name of the page and
>> if it is the oddball then include another include that has the extra
>> lines? 
> 
> <!--#if expr="$PAGE = /shop/" -->
> Extra links!
> <!--#else -->
> (Any specific non-shop stuff)
> <!--#endif -->

or just use one of the built-in variables that Apache 
provides for you, like DOCUMENT_URI:

  EXAMPLE: 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 -->

(example taken directly from the docs at
http://httpd.apache.org/docs/1.3/mod/mod_include#includevars)

hth, 

-dave



More information about the thelist mailing list