CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
SSI include - backward reference



Jan 13, 2000, 12:04 PM

Post #1 of 4 (2537 views)
SSI include - backward reference Can't Post

I want to put a simple SSI included file at the bottom of all my pages (you know, the standard footer example given in "what is SSI" articles). But, I have files in subdirectories.

When I type #include file="../footer.html" I get a [This directive generated an error.].

Yes, I know I can use virtual instead of file. But what if I move the page to somewhere with a different tree? Do I have to edit all my pages again? Seems to defeat the purpose of using SSI in the first place, imho.

Any help here would be greatly appreciated.

Administrator / Moderator

Jan 13, 2000, 12:48 PM

Post #2 of 4 (2537 views)
Re: SSI include - backward reference [In reply to] Can't Post

SSI doesn't recognize ../ as a relative path. Use this instead:

<!--#include virtual="/footer.html"-->

The forward slash immediately before any path information assumes the "document root", which your root html directory.


Jan 13, 2000, 1:09 PM

Post #3 of 4 (2537 views)
Re: SSI include - backward reference [In reply to] Can't Post

Okay, so what you are saying is that I shouldn't bother; I wanted a solution that would work whether the entire structure was moved from to Apparently that is not gonna happen with SSI. Oh well.

Administrator / Moderator

Jan 13, 2000, 6:07 PM

Post #4 of 4 (2537 views)
Re: SSI include - backward reference [In reply to] Can't Post

No, I didn't say that Smile

As long as footer.html stays in one place (in the example provided, in the root html directory), the pages calling the ssi can be anywhere. So the following pages:

can all use the same ssi call:

<!--#include virtual="/footer.html"-->

The forward slash tells the server in this example "look for footer.html in the root directory". Likewise, if your footer.html was in a subdirectory (named subdir), all of the above pages can use

<!--#include virtual="/subdir/footer.html"-->

It really doesn't matter where your pages are... it's the location of the file to be included(footer.html in this case) that's important.

So if you set up the pages on using /footer.html as the ssi path, moving it to will work as long as footer.html is in the root web directory.

[This message has been edited by Jasmine (edited 01-13-2000).]


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives