Chapter 14. Using HTML Templates
The next four chapters present an extended example from my own experience. A short time ago the principal of the local elementary school asked me to help with the school’s entry in the International CyberFair, an event in which schools compete in creating web sites. The students had chosen to compete in the category “Local Leaders,” meaning they would be creating a web site that profiled leaders from their local community. My contribution came in two forms: advising the students on basic HTML and web design issues, and building a set of Perl scripts to help simplify the process of creating and linking together a large collection of leader profiles and student pages.
This chapter begins that example by showing how to combine Perl with a simple template system in order to enforce design consistency across a large number of pages. Chapter 15 introduces the concept of using stored metainformation in a collection of HTML pages to automate the construction of links connecting those pages. Chapter 16 demonstrates how to pull out Perl code and place it in an external module file, so it can be shared across multiple Perl scripts. Finally, Chapter 17 shows how to build a CGI frontend to the system, helping inexperienced users add well-formed pages to it.
Using Templates
One of the first things I worked on for the Main School CyberFair project was a template system. Templates are a really obvious idea when you’re creating a set of web pages. Even without knowing ...
Get Perl for Web Site Management 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.