Server Side Includes: Virtual
A Virtual, Server Side Include (SSI) performs a document call on the server-side, and is used to include additional information within the currently requested document. One file can be called by many pages, or many files can be called by one page, making future adjustments of multiple documents simpler.
Copy the appropriate code and put it where you would normally put the information it is calling. The includes must refer to a relative path in relation to the web server address. URL addresses are invalid in virtual includes.
Document Including
Navigation text:
<!--#include virtual='/data/navigation/t.html' -->
where /data/navigation/t.html is the web path to find the desired file.
Environment Variables
The current date:
<!--#config timefmt='%A, %B %e, %Y' --><!--#echo var='DATE_LOCAL' -->
example: Monday, February 6, 2012
Gives your pages the appearance that they may be current and up to date.
The PHP equivalent for this would be:
<?= date('l, F j, Y') ?>
Date last modified:
<!--#config timefmt='%B %e, %Y' --><!--#echo var='LAST_MODIFIED' -->
example: November 18, 2007
This include simply inserts into your web page the date and time that the page was edited. This is useful in letting your viewers know how current the information is on that web page.
The PHP equivalent for this would be:
<?= date('F j, Y',filemtime($_SERVER['PATH_TRANSLATED'])) ?>
To retrieve previous web address:
<!--#echo var='HTTP_REFERER' -->
example:
This include simply inserts into your web page, or form, the address of the document that sent the viewer to this document. This is useful in understanding where a visitor was before sending feedback or reporting a problem.
The PHP equivalent for this would be:
<?= $_SERVER['HTTP_REFERER'] ?>
To retrieve current web address:
http://<!--#echo var='HTTP_HOST' --><!--#echo var='REQUEST_URI' -->
example: http://www.melvinwallerjr.com/tutorial/ssi/virtual.php
This include inserts into your web page, or form, the address of the current document. Use this when you wish to send the address of your current page to another service.
The PHP equivalent for this would be:
<?= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ?>
An HTML Include
The core Style Sheet for this site's pages:
<link rel="stylesheet" type="text/css" media="all" href="http://www.melvinwallerjr.com/common/core.css">
This applies the default contextual structuring for the web pages. This code goes on it's own line in the <head> of the document.
