There are some useful resources on SSI at faq253-3309
My understanding is that the [tt]file[/tt] directive is applied to the file system of the server, so you could use it to include files that are outside your webspace. For example, if your home page lives in a directory called /home/myuser/public_html, you could do this:
Code:
<!--#include file="/home/myuser/secure/blah.inc"-->
which would stop anybody gaining direct access to blah.inc over the web. However, SSI is often configured to disallow the use of this kind of file directive as it can present a security risk. What if somebody injected this into one of your pages somehow?
Code:
<!--#include file="/etc/passwd"-->
The [tt]virtual[/tt] directive, in contrast, identifies files in relation to your web root directory - i.e. the directory that your home page is in. Included files must be in your web space, and could be accessed individually if people know (or guess) the URL. That's not really a big problem though.
[...] then putting the include statement (<!-- #include virtual= -->) in a div tag?
Firstly, SSI is fussy about whitespace - don't put any spaces between the [tt]<--[/tt] and the [tt]#include[/tt] or it won't work.
Secondly, there's no reason to put the SSI inside a <div> element, in fact it's a bad idea. What you have to remember is that when the web server is dealing with SSIs, it's just sticking text files together, it doesn't care about HTML. What matters is that the document produced by that process is properly marked up HTML - it doesn't actually matter to the browser which bits come from the actual file and which from the SSI.
Here's the approach I'd recommend for using SSI in your pages.
On most websites, all pages conform to this pattern:
Code:
<html>
<head>
[i]Some elements specific to this page, eg <title>[/i]
[i][red]Some elements common to all pages, eg a stylesheet <link>[red][/i]
</head>
<body>
[i][red]Some elements, or part elements like an opening <div>, that are common to all pages[/red][/i]
[i]The actual unique content of the page[/i]
[i][red]Some elements, or part elements like a </div>, that are common to all pages[/red][/i]
</body>
</html>
I use three SSI includes to hold the three common (red) areas listed above. This technique, and its benefits, is expounded at more length in thread828-1086345 in my post dated 27 Feb 06 .
-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd