Forum Moderators: open
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.
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");
?>