90 likes | 159 Vues
Chapter 3. Creating Dynamic Web Sites Part 1. Large Sites. ”complex sites demand compartmentalization of some HTML or PHP code”. Require and Include. r equire(‘ filename.php ’); r equire_once (‘ filename.php ’); include(‘ filename.php ’); include_once (‘ filename.php ’);.
E N D
Chapter 3 Creating Dynamic Web Sites Part 1
Large Sites • ”complex sites demand compartmentalization of some HTML or PHP code”.
Require and Include require(‘filename.php’); require_once(‘filename.php’); include(‘filename.php’); include_once(‘filename.php’);
Require and Include • *_once( ) version guarantees that the file in question is included only once • If an include( ) does not work a warning with be printed in the browser and the script will continue to run. • With require( ) an error message is printed and the script stops.
Require and Include • Naming of included file • filename.inc.php • filename.inc.html
Template • Script 3.1 on page 79 • http://cscdb.nku.edu/csc301/frank/ch03/index.html • ch03\index.html
index.php • Script 3.4 on page 82 • http://cscdb.nku.edu/csc301/frank/ch03/index.php • ch03\index.php
header.html • Script 3.2 on page 80 • ch03\includes\header.html
footer.html • Script 3.3 on page 81 • ch03\includes\footer.html