Refactor error handling in HTMLLoader, enhance error templates, and add new entry and setup templates

This commit is contained in:
admin committed 2026-10-02 21:23:20 +02:00
1 parent 511d1fc220
commit 84e0630893
9 files changed
+64 -3

No files matched your search

+7 -3
View File
@@ -36,11 +36,11 @@ class HTMLLoader {
foreach ($page["css_files"] as $file) {
// Check if File exists
if (!is_file(TEMPLATE_PATH . $page["dir_name"] . "/" . $file)) {
$this->showError('CSS File <span class="code">' . $file . '</span> for Template <span class="code">error</span> in <span class="code">' . __FILE__ . "</span>");
$this->showError('CSS File <span class="code">' . $file . '</span> for Template <span class="code">error</span> in <span class="code">' . __FILE__ . "</span> not found.");
}
// Add CSS Files to HTML
$css .= '<link rel="stylessheet" type="text/css" href="http://' . APP_DOMAIN . "/templates/" . $page["dir_name"] . "/" . $file . '">';
$css .= '<link rel="stylesheet" type="text/css" href="http://' . APP_DOMAIN . "/templates/" . $page["dir_name"] . "/" . $file . '">';
}
$html = str_replace("%css%", $css, $html);
@@ -61,10 +61,12 @@ class HTMLLoader {
$html = file_get_contents(TEMPLATE_PATH . $page["dir_name"] . "/" . $page["html_file"]);
// Get CSS
$css = "";
foreach ($page["css_files"] as $file) {
// Check if File exists
if (!is_file(TEMPLATE_PATH . $page["dir_name"] . "/" . $file)) {
$this->showError('CSS File <span class="code">' . $file . '</span> for Template <span class="code">' . $this->template . '</span> in <span class="code">' . __FILE__ . "</span>");
$this->showError('CSS File <span class="code">' . $file . '</span> for Template <span class="code">' . $this->template . '</span> in <span class="code">' . __FILE__ . "</span> not found.");
}
// Add CSS Files to HTML
@@ -72,5 +74,7 @@ class HTMLLoader {
}
$html = str_replace("%css%", $css, $html);
die($html);
}
}