Chapter 18. Server Side Includes

In layperson’s terms, Server Side Includes (SSI) are special placeholders in an HTML document that the server replaces with actual data just before sending the final document to the browser. By the time the document gets to the browser, it looks just like any other HTML page (even if someone happens to “view source”), as though you typed the data into the HTML source by hand.

When the server looks through the file for placeholders (SSI commands), it is said to parse the file. The server then inserts the requested data, which could be anything from the current date and time to other HTML documents to the results of a CGI script. (The complete list of information available via Server Side Includes is listed later in this chapter.)

How SSI Is Used

SSI allows you to create the framework for pages that will be dynamically generated by the server. For the web author, this can be a powerful tool for managing site production and increasing efficiency. The following are just a few examples of the ways SSI can be used:

  • Placing elements that you use over and over again. If you have an element that appears on every page of your site, such as a complex navigational header, you can use a single SSI command that just sources it in instead. If you make changes to the header, such as changing a URL or a graphic, you need to make the change only once, and it will be updated automatically on all pages of your site.

  • Placing a constantly changing element on your ...

Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.