Custom Error pages
A custom error page is nothing but a class that implements the IErrorPage interface. The constructor will receive three parameters:
- $title - The title of the error
- $description - A brief description of the error. This could be f.ex. a call stack dump, so if you're outputting HTML you probably want to replace the newlines with the appropriate line breaks.
- $debug - Additional in-depth information. Not all errors include this parameter
After the error page has been constructed, the render method will be invoked. The constructor shouldn't output anything since that is the render method's job.
class MyErrorPage implements IErrorPage {
private $_title;
private $_description;
private $_debug;
function __construct($title,$description,$debug=null) {
$this->_debug = $debug;
$this->_title = $title;
$this->_description = $description;
}
function render() {
echo "Ooops! " . $this->_title . "\n";
echo $this->_description;
}
}
The next step is to assign your new error page in your core.php file:
config::set('lepton.core.errorpage', MyErrorPage);
