How to Build an About Page on a PHP Template
Building an About page for your PHP template system is a simple matter of creating a new file, instantiating the Page class, and adding content. Follow these steps:
Create a new empty file in your editor.
In the file, place the following code:
<?php require_once("classPage.php"); $page = new Page(); $page->titleExtra = "About"; print $page->getTop(); print <<<EOF <div id="mainContent"> <p>It's all about me.</p> </div> <!-- end main content → EOF; print $page->getBottom(); ?>
Save the file as about.php in your document root.
View the page in your browser by going to http://localhost/about.php.
The page should look like the following. Notice the new title bar.
Looking at the code that you created in this exercise, notice that it’s similar to the code for the home page. The only changes are to set the titleExtra property and to change the actual HTML content of the page.
That’s the beauty of templating systems: You can now create many, many pages, quickly and easily. If you need to change something or add a new menu item, you can do so in one location and it will automatically and instantly be updated across all the pages.