Saturday, June 13, 2009

Using require for Web Site Templates

If your company has a consistent look and feel to pages on the Web site, you can use
PHP to add the template and standard elements to pages using require().
For example, the Web site of fictional company TLA Consulting has a number of
pages all with the look and feel shown in Figure 5.2.When a new page is needed, the
developer can open an existing page, cut out the existing text from the middle of the
file, enter new text and save the file under a new name.

Consider this scenario:The Web site has been around for a while, and there are now
tens, hundreds, or maybe even thousands of pages all following a common style.A decision
is made to change part of the standard look—it might be something minor, like
adding an email address to the footer of each page or adding a single new entry to the
navigation menu. Do you want to make that minor change on tens, hundreds, or even
thousands of pages?
Directly reusing the sections of HTML that are common to all pages is a much better
approach than cutting and pasting on tens, hundreds, or even thousands of pages.

No comments:

Post a Comment