Server Side Include (SSI)
According to Wikipedia,
the primary use for an SSI is to include the contents of one file into another. For
example, this can be useful to ensure that the footer information is consistent throughout a
website, the current copyright year and current update date are displayed at the bottom of
each webpage.
When you want to edit an HTML file that contains an SSI, use unsecure ftp and the odata login to
copy the file from the Library Web to your computer.
This tutorial covers three kinds of SSI:
- An SSI comment tag that reads in text/mark-up from
a file that you've created, and lives in the same directory as the
HTML file that calls it.
- An SSI comment tag that reads in the date in
mm/dd/yy format from the Library Web server.
- An SSI comment tag that reads in the year in yyyy
format from the Library Web server.
The format of the first kind of SSI comment is:
<!--#include file="filename"-->
- The file that contains the text/mark-up that you wish to read into an
HTML file must use the file extension .ssi.
- The file that contains the text/mark-up that you wish to read into an
HTML file must live in the same directory as the HTML file.
How to create an SSI file
- Create the SSI text/mark-up file in a text editor such as Notepad. Type in the text and HTML
mark-up that you want to be read into an HTML page.
- When you're ready to save the file to your computer, the text editor will force you to add
the extension .txt to the file's name.
- After you've saved the file, rename it to filename.ssi
This renaming process may be done via the file structure on your computer, or via the
FTP upload process.
How to add an SSI comment that calls the contents
of a file into a webpage
- Open your Web authoring tool.
- Open the HTML file you want to edit. If you use a WYSIWYG tool such as
Dreamweaver, or Netscape Composer, switch to the markup/tag view.
- Wherever you want to "read in" text/mark-up from an include file, add an
SSI comment tag in the format:
<!--#include file="filename.ssi"-->
- Replace "filename.ssi" will the name of the SSI file you've created.
For example, the Bioscience & Natural Resources
Library website uses an SSI to read in its copyright/footer
information. The BIOS SSI comment tag looks like this:
<!--#include file="footer.ssi"-->
The file named footer.ssi lives in the BIOS
directory.
- Use unsecure FTP to transfer the SSI file and the HTML file into your
/pub/incoming/web/ folder. Notify webman@library that the two files are
ready for upload into production.
- When you need to edit the HTML page that contains an SSI comment tag,
use unsecure ftp and the odata
login to transfer a copy of the HTML page from the Library Web server onto your
computer.
- When you need to edit the actual SSI file, you may save it to your
computer via unsecure ftp and the odata
login, or via your web browser.
How to add an SSI comment that reads in the date in
mm/dd/yy format from the Library Web server
- Open your Web authoring tool.
- Open the HTML file you want to edit. If you use a WYSIWYG tool such as
Dreamweaver, or Netscape Composer, switch to the markup/tag view.
- Wherever you want to read in the date in mm/dd/yy format from the
Library Web server, add these two SSI comment tags:
<!--#config timefmt="%D"--><!--#echo var="LAST_MODIFIED" -->
- You do not need to create an SSI file. The SSI comment tags above read
in data from the Library Web server.
How to add an SSI comment that reads in the year in
yyyy format from the Library Web server
- Open your Web authoring tool.
- Open the HTML file you want to edit. If you use a WYSIWYG tool such as
Dreamweaver, or Netscape Composer, switch to the markup/tag view.
- Wherever you want to read in the year in yyyy format from the
Library Web server, add these two SSI comment tags:
<!--#config timefmt="%Y"--><!--#echo var="LAST_MODIFIED" -->
- You do not need to create an SSI file. The SSI comment tags above read
in data from the Library Web server.
Contact webman if you have any questions about SSI, or this tutorial.
|