Server side includes

Discussion in 'HTML' started by Glen, Aug 10, 2005.

  1. Glen

    Glen Guest

    I have a menu bar in the directory above the directory which has a shtml
    file with the line <!--#include file="../menu.html" -->
    I get a message saying an error occurred while processing this directive.

    If I move a copy of the menu file in the same directory and change the line
    to <!--#include file="menu.html" --> it works perfectally.

    How can I have the on file in the top directory instead of a copy in each
    directory?

    Thank-you
     
    Glen, Aug 10, 2005
    #1
    1. Advertisements

  2. You might even try using the "virtual" parameter for that include, like
    this:
    <!--#include virtual="../menu.html" -->

    With the "virtual" parameter, the root directory ("/") references the
    public_html directory (or htdocs, depending on what it's called on your
    particular server).
     
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=, Aug 10, 2005
    #2
    1. Advertisements

  3. Glen

    Toby Inkster Guest

    Possibly some security mechanism is stopping you from including files
    from upwards in the directory tree.

    Solution would be to keep the following files:

    /menu.html (the real menu)
    /somedir/menu.html (symbolic link to "../menu.html")
    /somedir/page.html (which includes "menu.html")
    /otherdir/menu.html (symbolic link to "../menu.html")
    /otherdir/page.html (which includes "menu.html")
     
    Toby Inkster, Aug 10, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.