add templates error and setup
This commit is contained in:
1 parent
7dffa95fed
commit
f8a40bb668
4 files changed
+57
-20
No files matched your search
+29
-2
@@ -16,9 +16,36 @@ class HTMLLoader {
|
||||
|
||||
if (!array_key_exists($template, $json) && array_key_exists("error", $json)) {
|
||||
$this->showError('Template "' . $template . '" was not found.');
|
||||
|
||||
}else{
|
||||
exit;
|
||||
}elseif (!array_key_exists("error", $json)){
|
||||
die("Error Template was not found.");
|
||||
}
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
function showError($error) {
|
||||
$file = file_get_contents(TEMPLATE_CONF);
|
||||
$json = json_decode($file, true);
|
||||
|
||||
$error_page = $json["error"];
|
||||
$error_html = file_get_contents(TEMPLATE_PATH . $error_page["dir_name"] . "/" . $error_page["html_file"]);
|
||||
|
||||
// Write error
|
||||
$replace = str_replace("%error%", $error, $error_html);
|
||||
|
||||
die($replace);
|
||||
}
|
||||
|
||||
function show() {
|
||||
$template = $this->template;
|
||||
|
||||
$file = file_get_contents(TEMPLATE_CONF);
|
||||
$json = json_decode($file, true);
|
||||
|
||||
$page = $json[$template];
|
||||
$html = file_get_contents(TEMPLATE_PATH . $page["dir_name"] . "/" . $page["html"]);
|
||||
|
||||
// Get CSS
|
||||
foreach ($page[""])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user