Checking for an error from file_get_contents()
$page = file_get_contents('page-template.html');
if ($page === false) {
print "Couldn't load template: $php_errormsg";
} else {
// ... process template here
}
//page-template.html
<html>
<head><title>{page_title}</title></head>
<body bgcolor="{color}">
<h1>Hello, {name}</h1>
</body>
</html>
Related examples in the same category