A Content Publishing Example

Let’s look at an example of how a content publishing system might work. This example illustrates how an online publication like a magazine or newspaper might publish articles using a template system. In this case, the page will be generated every time the user visits the page. The system consists of three components: a story-input program (which allows writers to submit stories), the stories themselves, and a story-display program (which applies a template to a story and displays it in the browser).

First let’s look at the template file and the data files. The template looks like a regular HTML file but it contains placeholders that take will be populated with content from the data files. The template file is included ...

Get Sams Teach Yourself CGI in 24 Hours, Second 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.