Prado\Exceptions\TErrorHandler::getErrorTemplate PHP Method

getErrorTemplate() protected method

External exceptions are those displayed to end-users. They do not contain error source code. Therefore, you might want to override this method to provide your own error template for displaying certain external exceptions. The following tokens in the template will be replaced with corresponding content: %%StatusCode%% : the status code of the exception %%ErrorMessage%% : the error message (HTML encoded). %%ServerAdmin%% : the server admin information (retrieved from Web server configuration) %%Version%% : the version information of the Web server. %%Time%% : the time the exception occurs at
protected getErrorTemplate ( $statusCode, $exception ) : string
return string the template content
    protected function getErrorTemplate($statusCode, $exception)
    {
        $base = $this->getErrorTemplatePath() . DIRECTORY_SEPARATOR . self::ERROR_FILE_NAME;
        $lang = Prado::getPreferredLanguage();
        if (is_file("{$base}{$statusCode}-{$lang}.html")) {
            $errorFile = "{$base}{$statusCode}-{$lang}.html";
        } else {
            if (is_file("{$base}{$statusCode}.html")) {
                $errorFile = "{$base}{$statusCode}.html";
            } else {
                if (is_file("{$base}-{$lang}.html")) {
                    $errorFile = "{$base}-{$lang}.html";
                } else {
                    $errorFile = "{$base}.html";
                }
            }
        }
        if (($content = @file_get_contents($errorFile)) === false) {
            die("Unable to open error template file '{$errorFile}'.");
        }
        return $content;
    }