Use Server Side Includes
Server Side Includes (SSI) are codes you can add to your HTML document that tell the web server to include other content with the document being served. For example, you can use an #include statement to display the same header and footer on your pages automatically; if the information changes, you can save time by editing a single header.html
or footer.html
file. You can also use SSI for graphics such as logos or image maps that should appear on multiple pages.
On Sitehost accounts, pages that use SSI (#include statements) need the .shtml
extension. Included files can have other extensions (for example, .html
).
#exec
command is often used to run a CGI or Perl program from a web page; for security reasons, the #exec
SSI is not enabled on Sitehost. Use SSI with files in the same directory
In SSI, the #include statement tells the server to include another file:
<!--#include file="filename.html"-->
You can use SSI to display banner and header information, as in the following example:
<!--#include file="header.html" -->
In the above example, the #include statement appears in the body of the document, immediately after the <body> tag. In SSI, the process of including takes two separate files and creates one whole file. The server takes the SSI page and inserts it into the page calling it.
Use SSI with files located in different directories
If the SSI calls a file that is located in another directory in the account, use #include virtual
instead of #include
file
. For example:
<!--#include virtual="../header.html" -->
In the above example, the header.html
file is located in the directory above the location of the file referencing it.
Footers
Page footers can be created dynamically, so that the date that the file was last modified automatically appears in the footer. The server side include statement calls another .shtml
file, using this code:
<!--#include file="footer.shtml" -->
The footer statement on this page is placed at the bottom of the file, just before the </BODY> tag.
For more about using SSI, see Server Side Includes tutorial.
This is document bfsa in the Knowledge Base.
Last modified on 2023-07-24 12:11:27.