Webhosting Server Side Includes: Difference between revisions
(Created page with "link=:Category:Webhosting Our servers do not offer SSI facilities <!--#include virtual="ssi.htm" --> or <!--#include file="ssi.htm" --> however you can cr...") |
mNo edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
[[File:Couk.png|link=:Category:Webhosting]] |
|||
⚫ | |||
How? |
How? |
||
Line 10: | Line 6: | ||
First: |
First: |
||
Include the following in the <head></ |
Include the following in the <code><head><head></code> section of your page |
||
<SyntaxHighlight> |
<SyntaxHighlight> |
||
Line 23: | Line 19: | ||
with your own file name substituted where you want the included text to appear. |
with your own file name substituted where you want the included text to appear. |
||
Then: |
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. |
Create a file myincludefilename.js to hold the text you want to output, then insert the text and wrap each line in a <code>document.write(" ");</code> statement. |
||
Remember that in JS any newline characters ends the instruction so every line must be wrapped in a document.write statement. |
Remember that in JS any newline characters ends the instruction so every line must be wrapped in a <code>document.write</code> statement. |
||
The javascript file can have any extension, and be held in any folder subject to the usual rules about valid pathnames. |
The javascript file can have any extension, and be held in any folder subject to the usual rules about valid pathnames. |
||
Example: Good |
Example: Good |
||
Line 53: | Line 47: | ||
A web search on 'javascript include' will bring up lots more examples. |
A web search on 'javascript include' will bring up lots more examples. |
||
⚫ | |||
⚫ | |||
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl> |
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl> |
||
Line 62: | Line 53: | ||
[[Category:Webhosting]] |
[[Category:Webhosting|Server]] |
||
[[Category:Domains]] |
Revision as of 22:23, 15 August 2020
Our servers do not offer SSI facilities <!--#include virtual="ssi.htm" -->
or <!--#include file="ssi.htm" -->
, however you can create the same effect by using Javascript. 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.
Other Webhosting pages
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl>