by dolinsky · 17y ago · 0 comments
$errorTemplate = file_get_contents("errortemplate.html");
$templates = explode('%error%', $text, 2);
ini_set('error_prepend_string', $templates[0]);
ini_set('error_append_string', $templates[1]);
ini_set('html_errors', '0');
The errortemplate.html file is a static HTML file that can contain anything you want. Ours is themed up just like any other page on our website. When a fatal error is triggered, the text %error% will be replaced with the fatal error text. We place that into a form using a hidden textarea so our users can submit it to us. <textarea style="display: none;">%error%</textarea>
The server log will contain the fatal error, so you don't care about users submitting it you can just wrap it in a comment. <!-- %error% -->
And that's all there is to it.