13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using require() for <strong>Web</strong>site Templates<br />

139<br />

Listing 5.1<br />

Continued<br />

<br />

Welcome to the home of TLA Consulting.<br />

Please take some time to get to know us.<br />

We specialize in serving your business needs<br />

<strong>and</strong> hope to hear from you soon.<br />

<br />

<br />

<br />

<br />

&copy; TLA Consulting Pty Ltd.<br />

Please see our<br />

legal information page<br />

<br />

<br />

<br />

<br />

<br />

You can see in Listing 5.1 that a number of distinct sections of code exist in this file.The<br />

HTML head contains cascading style sheet (CSS) definitions used by the page.The section<br />

labeled “page header” displays the company name <strong>and</strong> logo,“menu” creates the<br />

page’s navigation bar, <strong>and</strong> “page content” is text unique to this page. Below that is the<br />

page footer.You can usefully split this file <strong>and</strong> name the parts header.php, home.php,<br />

<strong>and</strong> footer.php. Both header.php <strong>and</strong> footer.php contain code that will be reused on<br />

other pages.<br />

The file home.php is a replacement for home.html <strong>and</strong> contains the unique page content<br />

<strong>and</strong> two require() statements shown in Listing 5.2.<br />

Listing 5.2<br />

home.php—The <strong>PHP</strong> That Produces TLA’s Home Page<br />

<br />

<br />

Welcome to the home of TLA Consulting.<br />

Please take some time to get to know us.<br />

We specialize in serving your business needs<br />

<strong>and</strong> hope to hear from you soon.<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!