Back to Internet 101

Question: What is a server side include?

Answer: Server side includes (SSI)s inserted into an HTML document allow real-time features to be inserted into a web page.

Server side includes are scanned by the server when you request to see an HTML document. These special tags inserted into the HTML will flag certain information from the server to be inserted into the page as it is sent to your browser. For instance:

SSI example in redSSI code
today is January 27, 2007
<!--#config timefmt="%B %e, %Y"-->
<!--#echo var="DATE_LOCAL"--> 
The current time is 15:00:01
<!--#config timefmt="%H:%M:%S"-->
<!--#echo var="DATE_LOCAL"-->
your IP address is 75.49.226.88
<!--#echo var="REMOTE_ADDR"-->
your DNS entry is adsl-75-49-226-88.dsl.stlsmo.sbcglobal.net
<!--#echo var="REMOTE_HOST"-->
this document was last modified on
December 21, 2011
<!--#config timefmt="%B %e, %Y"-->
<!--#echo var="LAST_MODIFIED"-->

There are several other SSI's in addition to these examples. One of the things that I've used is a SSI to include a common file into another HTML document. If you look at the bottom of all these pages from the Internet Basics 101 site, you probably noticed that the bottom of every page has the same footer. Well - I virtually included that file into all of the other files. If I changed the footer it would change on all of the pages.


Question: I typed some of those SSI things in and they DO NOT Work! Why?

    Answer: Server side includes must be interpreted by the server. That means that the server must be set up to allow SSIs. Because of the security issues and the fact that most people are not aware of them, many service providers do not make them available for public use. SSI's must be viewed from a server! If you view a SSI as a local file it will not do anything.

Question: Hey now - you're pulling my leg. I looked at the source of this page and the information is typed in. What's up?

    Answer: Server side includes are parsed or interpreted at the server and the interpretation is sent to you. Therefore you don't see the source - just the results.

6858

Back to Internet 101