Forum Moderators: open
<!--#include virtual="/ssi/navbar.shtml" -->
From what I have learned, you are always supposed to save your pages with the .shtml extension. I have used them and I love them.
Also, create a directory for all your includes to be held in. If you use them for more then your navigation.
Hope this helps!
4~css!
<?php include ("myIncludesDirectory/myNavBar.php"); ?>
Such a file like myNavBar.php would contain the EXACT same bits of html code and nothing else... i.e. for a navBar, just the links, no <head> or <body> tags, etc)
I think that a file like navbar.shtml would have to have the <head> and <body> tags...
maybe I'm wrong...
This is also good for header and footer information
What you would do is take the whole area of the list that you are using. If I have the list within a div, I just cut the information out of the div, put it into a text file and insert the ssi code. It is really easy to do.
You can always do a search on google for tutorials on this. There are a number of them out there that are really great to read.
- Plain text file (no headers required, a single word, even)
- output from a script or a compiled program (see SSI man. for exec directive). In this case, you must print content-type: text/html headers from your external program (or other valid content-types.)
- RSS/XML (but your document has to be a valid XML/XHTML doctype and you have to provide XML headers)
- image or other binary data
Basically anything you can output in a page you can include in the page using SSI. It doesn't have to be a valid HTML/XHTML document - in fact, doing so might screw up a perfectly valid document:
<html><head><title>Title</title><body>
<!-- below is my include, do the math! -->
<html><head><title>Include</title></head><body>
<p>Two plus Two.</p>
</body></html>
<!-- End of my include -->
</body></html>
The data you include becomes part of the page, so you just validate the entire .shtml with all the data imported.
In older server O.S's the use of SSI's presented serious security flaws and it was a memory hog (because it parses files before reading instead of straight serving) but it's no longer the case.