Forum Moderators: open

Message Too Old, No Replies

SSI doesn't work

         

aditan22

10:07 am on Oct 7, 2004 (gmt 0)

10+ Year Member



Hello,

I'm creating a website which has several pages, and in each page I put a SSI (server side include) codes like this:

<!-- include "dir1/file1.php -->

after I opened the pages on browser, some of pages are working, some are not. The ones which working are those pages that reside on parent directory of "dir1". So I thought it's directory problem, and I changed the code like this:

<!-- include "/dir1/file1.php -->

now it shows an error says something like it couldn't find file1.php. I wonder, is SSI not be able to read directory structure from root or what?

thanks in advance.

sonjay

10:41 am on Oct 7, 2004 (gmt 0)

10+ Year Member



Try this:
<!--#include virtual="/dir1/file1.php" -->

The syntax for file is:
<!--#include file="dir1/file1.php" -->

"Virtual" should be used to call files from above the directory that the calling page is in. Anything in the same directory, or below, can be called with "include file," but to go up one or more levels, you need to use virtual. I always use virtual, with the leading slash so that it always starts at the document root of the site.

If your pages are php, you can use php's include function:
<?php
virtual ("/dir1/file1.php");
?>

MozMan

3:32 pm on Oct 7, 2004 (gmt 0)

10+ Year Member



Also, in your original example you forgot the pound sign (#), so you include command became nothing more than an HTML comment...

aditan22

5:51 am on Oct 8, 2004 (gmt 0)

10+ Year Member



Thanks!

After looking for some reference I found that it should be :
<!--#include file="dir1/file1.php" -->
like Sonjay said. I'll try this.. :)

Sorry Mozman, I got some typo on my previous post.

Thanks for all your advice.. :)