HTML Master Pages

What Is It?

Short Answer

HTML Master Pages combines reusable, nest-able templates with content documents using only HTML to set up this simple merge. Unlike other template systems, HTML Master Pages is easy to use because no programming is needed to use it and it combines entire HTML documents together including all HEAD tags and identified BODY content.

In pictures:

1. Start with a Master Page template:

A Simple, Site-Wide Master Page (Styling For Emphasis)

2. Add any number of other separate content documents:

Another Simple Content Document With Included and Excluded Body Content

3. Get an automatic merge every time your visitors access the content documents:

Merged Page Generated On-The-Fly

Long Answer

HTML Master Pages is a light-weight Apache web server handler that enables web developers to use pure HTML to enjoy the concept of what Microsoft dubs "Master Pages" (introduced with ASP.NET). In short, "Master Pages" are HTML templates that have one or more place-holders which receive content from other web pages so that common layout, styling, and other elements are conveniently "wrapped around" all other web pages that are subordinate to the Master Page. Anyone who can competently write HTML can use HTML Master Pages, offering a much lower barrier to this powerful development technique than other SSI- and CGI-based Master Page solutions.

From the perspective of web developers already familiar with the concept of Master Pages, existing SSI technologies and other CGI-based Master Page solutions tend to get one or both of these key ideas wrong:

  1. Other solutions only work with "fragments" of HTML documents, forcing web developers to deal with only partial HTML files that can be difficult to thread together such that all their tags are closed properly, and -- over time -- tend to become disjointed or worse, untenable messes of layered and archaic #include statements that break unexpectedly, dump tags into the wrong parts of the resulting document, or result in invalid pages that cannot pass W3C HTML validation [which is important if you truly seek cross-browser, cross-platform compatibility with generally-consistent page rendering].
  2. They require web developers to also be CGI programmers, necessitating that they learn PHP, Perl, Python, or other such languages [which is a barrier to someone who already has a grasp of HTML and just wants access to Master Pages with the knowledge they already have].

This is where HTML Master Pages gets it right and excels. With this solution, web page authors need only possess a rudimentary competency with HTML and they get to work with whole, valid HTML documents at all times!

Technical Details

Driving this web-site and others, HTML Master Pages is William Kimball's take on the concept of "Master Pages". In applying this concept to the Apache web server (without ASP.NET) and improving upon it, William's version is an even simpler-to-use, light weight, yet highly intelligent "Reverse-SSI" system wherein entire, complete HTML documents are merged; not just by concatenating disjointed document fragments (like the typical trio of "header.html", "footer.html", and "content.html" that are necessitated by other solutions) but by truly merging whole HTML documents on demand. As with other Master Page solutions, this one also provides consistent page layouts and site-wide styling but adds other treatments like:

The best part? No programming is required from the web page author to use it! Once installed, this solution provides about as close to a "pure HTML" Master Pages solution as you can get!

Disclosure

On the server, HTML Master Pages is based on PHP 5.3 for use with Apache web servers. Because this is a fairly simple PHP-based handler, it may be portable to other web server platforms, but William has not attempted any such experiments. In fact, porting this solution to other CGI languages like Perl or Python (within the terms of the licensing of William's original PHP version) should also be trivial, if necessary.

Users of this solution do not need to know anything about PHP to use HTML Master Pages. However, they may write any amount of PHP code for use with their web pages without interfering with HTML Master Pages (with some notable caveats that are discussed in the manual).