Forum Moderators: coopster
I have a PHP script that generates an error page for my form processor. The script generates the page in the following manner:
print <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html>
<head>
<title>Form Errors</title>
</head>
<body>
Error page content goes here.
</body>
</html>
EOF;
I want the error page thus generated to use the same header and footer as the rest of my site. The header and footer are .cgi files that I call with SSI on my HTML pages. But, I can't seem to get them included in the page generated by the above.
I tried creating a new header.html page with the only contents being the SSI to call my header.cgi file. Then, I tried to include header.html in the PHP code shown above. For some reason it didn't work; what might I be doing wrong?
Thanks,
Matthew
$page = "
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">\n\n
<html>
<head>
<title>Form Errors</title>
</head><body>".include("header.html")."
Error page content goes here.
".include("footer.html")."</body></html>";
print $page;
function display_errors($errors){
$errors = '<li>' . join('<li>', $errors);print <<<EOF
<html>
<head>
<title>Form Errors</title>
EOF;
include 'http://mydomain.com/header.html';
print <<<EOF
<ul>$errors</ul>
EOF;
include 'http://mydomain.com/footer.html';
print <<<EOF
</body>
</html>
EOF;
}
The problem now is, on the error page, a warning message appears above the header and the footer, like this:
Warning: display_errors(): stream does not support seeking in /path/to/my/cgi-bin/formprocessor.php on line 378
Where line 378 is the line where my header include is placed. (Same error just above the footer, but a different line number.)
So now that I've got the header and footer on the page, how do I get rid of those warnings?
Thanks,
Matthew