User's Manual
Building the Departments Page
3-2 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
$title = htmlentities($title);
echo <<<END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Any Co.: $title</title>
</head>
<body>
<h1>$title</h1>
END;
}
function ui_print_footer($date)
{
$date = htmlentities($date);
echo <<<END
<div class="footer">
<div class="date">$date</div>
<div class="company">Any Co.</div>
</div>
END;
}
?>
Q The design of this application makes use of PHP function definitions to enable
modular reusable code.
Q The PHP functions defined in the anyco_ui.inc file contain parts of the
original HTML contents from the first anyco.php you created.
Q The functions in anyco_ui.inc, make use of a PHP language construct
called a "here document". This enables you to place any amount of HTML
formatted text between the following two lines:
echo <<<END
END;
The END; line must not be prefixed with leading spaces otherwise the rest of
the document is treated as part of the text to be printed. Any PHP parameters
appearing inside the body of a "here document" are replaced with their values,
for example the $title or $date parameters.
Q The PHP function htmlentities() is used to prevent user-supplied text
from containing HTML markup.
3. The PHP file makes use of a Cascading Style Sheet (CSS) file called style.css to
specify presentation style in HTML in the browser.
Use your editor to create style.css in the chap3 directory with the following
CSS text:
body
{ background: #CCCCFF;
color: #000000;
font-family: Arial, sans-serif; }
h1