Week 6: Using Functions and Server Side Includes
Description
With PHP you can easily create a consistent page layout and format style across all your web pages. You simply generate your pages using PHP and include the stylesheets and other components you want to appear on all pages with server side include statements.
For example, the page you are looking at (week06.php) includes two other files. The first (left.php) contains the A HREF tags you see in the green area on the left. The second (utils.php) contains a LINK tag to the stylesheet and a META tag. Note, that there is no php in the utils.php file, although it has the extension php. You can certainly put php in the file if you wish -- php function definitions that are called frequently are often included in util files. Note the location of the include statements. If the purpose of the php include file is to generate HTML tags, then the include statement should be where you want those tags to be in the page.
<?php require_once 'utils.php' ?> // within the head tag
<?php include_once 'left.php' ?> // where the left menu should be
Testing function call:hello and goodbye
221
Testing print function call:
My name is Auyon,Paulino
My friend's name is Mouse,Mickey
Testing sum function call:
1 + 16 = 17