SSI Problem

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Okay, I'm trying to use SSI for the site that I'm building now. I've used them before but not with a directory structure as deep as this one and that's why I'm having problems.

I've got my include files in a separate include directory, and I want to use those same files on every page in the site and get them to work! So, how can do that and get the links to work and everything? I hope you know what I mean here....

This is the site - if you click on "Athletes" on the left and then any one of the links on that page you'll see what I mean.

http://www.gym-routines.com/gymnca/

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

could you draw for us a file structure? like:

+folder1
-file1
-file2
-file3
+folder2
  -file4
+folder3
-file5
'

are you using file or virtual?
are you using ../?

Mark Hensler
If there is no answer on Google, then there is no question.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Here's my file structure so far:

+ Athletes
  - jwomen.shtml
  - swomen.shtml
  - wretired.shtml
+ Events
  - reports.shtml
  - calendar.shtml
  - results.shtml 
  + results
    - nationals.shtml
    + nationals
      - 88nats_srw.shtml
+ templates
   - header.html
   - footer.html
   - style.css
.....
'

That's just part of it right there (and not all of that is uploaded BTW, just the first two levels really) - there will be a lot more eventually.

The SSI code in the second level folders (jwomen.shtml, swomen.shtml etc.) looks like this:

<!--#include virtual="../templates/header.html" -->'

Thanks for your help!

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

Not sure what you mean by "directory structure".

You can definately nest SSI Includes (I do that a lot) and it's shouldn't matter what dir the included file is in. You just provide the virtual path to each file (I don't use the ".." and it works on my servers.)

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Hmm... i tried that and it didn't work... I'll try again on a different server account.

They have: 488 posts

Joined: Feb 2000

I agree with Jaiem, I don't use the period in front of the file path and it works on my server.

Quote:
(I don't use the ".." and it works on my servers.)

Using the 2 periods in front of the file path cause an error for me. Maybe it can't find the sub-directory and file as the period could mean 2 levels down as in DOS.

[Edited by NSS on Dec. 11, 2000 at 08:31 PM]

AndyB's picture

They have: 344 posts

Joined: Aug 1999

dumb trick may help ... put an image in the same folder as the includes, then create a link from your top level html files to the image. If the image shows, then you have the correct relative path to the includes folder.

But - once the included file is included in an upper level html file its intrinsic relative link structure will be different from its 'natural' state ... if you know what I mean????

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

good point AndyB!
you should use full paths for images inside included files.

at work I use file="../../file.asp". it's on an NT server with IIS.
at home I use virtual="../file.html". it's on a *nix box with apache.

it may just be the way your web server is set up...

try file="/dir/file.ext" this will start at the root dir

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.