Webhosting Server Side Includes

From AAISP Support Site
Revision as of 16:57, 11 November 2023 by Adsb (talk | contribs) (The workaround only applies to #include)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Our servers do not offer SSI facilities. SSI provides a simple programming language to do a limited set of operations on text. For example, including other HTML files, or printing HTTP environment variables.

E.g.

  • <!--#include virtual="ssi.htm" --> or <!--#include file="ssi.htm" -->
  • <!--#echo var="LAST_MODIFIED" -->

You can create the same effect for includes by using Javascript (although these will be actually be client side includes). These notes were submitted by a customer and are here to help you.

How?

First:

Include the following in the <head><head> section of your page

<SCRIPT language="JavaScript" > </SCRIPT>

and

<script type="text/javascript" src="myincludefilename.js"> </SCRIPT>

with your own file name substituted where you want the included text to appear.

Then:

Create a file myincludefilename.js to hold the text you want to output, then insert the text and wrap each line in a document.write(" "); statement.

Remember that in JS any newline characters ends the instruction so every line must be wrapped in a document.write statement.

The javascript file can have any extension, and be held in any folder subject to the usual rules about valid pathnames.

Example: Good

document.write("James Brown is in the office <br>");

document.write("Helen Smith is out of office <br>");

Example: Bad

document.write("James Brown is in the office <br>

"Helen Smith is out of office <br>");

A web search on 'javascript include' will bring up lots more examples.

Webhosting Service page on our main website