The class constructor accepts the filename of the specified HTML document and serves as a template. As this class deals strictly with HTML (as compared to JSON output, for example), the Content-Type header is set to text/HTML.
The next two methods populate the headers and inserts lists. Headers represent HTTP headers that need to be sent upon output. The class constructor, shown previously, adds the first header to the list: the Content-Type header represents a list of placeholders in the HTML template document, which are subsequently replaced by a given value.
Finally, the render() method pulls everything together. First, the headers are assembled, separated by a carriage-return linefeed (\r\n), as mandated by the HTTP protocol. Next, the inserts are processed: the placeholders in the seed HTML template are replaced with their respective values. The rendered HTML is then returned for output by the calling program.