In this lesson our instructor talks about include files and web application introduction. First, he discusses include statement, include path, and code reuse. Then he talks about require statement, coding conventions, and introduction to our web application. He ends the lesson with a homework challenge.
An include statement is used to include the contents of one PHP file
within another PHP file. The included file is referred as an ‘include
If a file included via an include statement cannot be found, PHP will issue a
warning, and the script will continue executing.
A require statement performs the same action as an include statement,
except that if the file to be included cannot be found, a fatal error occurs halting
the execution of the script.
Code reuse is a practice used to place redundant or common PHP and HTML
code in separate files allowing you to make changes in one place and have it affect
For this course, include files containing only HTML will have a
.html extension. Those containing only PHP code will have a .php
extension, and those containing both HTML and PHP code will have a .phtml
Each version of the store web application will be located in a
intro2php/web_app/version-x.x directory in the document root. Include files
for each version will be contained in a corresponding
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.