Home

How to Manage HTML5 and CSS3 Content with Server Side Includes (SSIs)

|
Updated:  
2016-03-26 13:12:59
|
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon

HTML5 and CSS3 web developers have long used the simple SSI (Server Side Include) trick as a quick and easy way to manage content. It involves breaking the code into smaller code segments and a framework that can be copied.

image0.jpg

Even if you view the source code in the browser, you don’t find anything unusual about the page.

However, if you look at the code in a text editor, you find some interesting discoveries:

<!DOCTYPE html>
<html lang = "en-US">
 <head>
 <meta charset = "UTF-8">
 <title>csSSI.shtml</title>
 <link rel = "stylesheet"
   type = "text/css"
   href = "csStd.css" />
 </head>
 <body>
 <div id = "all">
  <!-- This div centers a fixed-width layout →
  <div id = "heading">
  <!--#include virtual = "head.html" →
  </div><!-- end heading div →
  <div id = "menu">
  <!--#include virtual = "menu.html" →
  </div> <!-- end menu div →
  <div class = "content">
  <!--#include virtual = "story1.html" →
  </div> <!-- end content div →
  <div class = "content">
  <!--#include virtual = "story2.html" →
  </div> <!-- end content div →
  <div id = "footer">
  <!--#include virtual = "footer.html" →
  </div> <!-- end footer div →
 </div> <!-- end all div →
 </body>
</html>

Some interesting things are happening in this code snippet:

  • The page has no content! All the actual content are gone. This page, which contains only structural information, is the heart of any kind of CSS — the structure is divorced from the content.

  • A funky new tag is in place of the content. In each place that you expect to see text, you see an

About This Article

This article is from the book: 

About the book author:

Andy Harris earned a degree in Special Education from Indiana University/Purdue University–Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
Andy welcomes comments and suggestions about his books. He can be reached at [email protected].