This commit is contained in:
2025-12-26 01:26:28 +01:00
parent 4e90cea177
commit 9fb863365c

View File

@@ -43,21 +43,32 @@ if ($uriPath === '' || $uriPath === 'index' || $uriPath === 'index.php') {
// Layout-Regel // Layout-Regel
// ------------------------------------ // ------------------------------------
$skipLayout = false; $skipLayout = false;
$targetReal = realpath($target);
// Beispiel: alles unter /page/raw/* ohne Layout // Beispiel: alles unter /page/raw/* ohne Layout
if (str_starts_with(realpath($target), realpath(__DIR__ . '/page/retool'))) { if ($targetReal && str_starts_with($targetReal, realpath(__DIR__ . '/page/retool'))) {
$skipLayout = true; $skipLayout = true;
} }
// ------------------------------------ // ------------------------------------
// Ausgabe // Ausgabe
// ------------------------------------ // ------------------------------------
// Erst Inhalt laden (ohne Ausgabe), damit Header/Redirects vor HTML funktionieren
ob_start();
require $target;
$content = ob_get_clean();
// Wenn bereits Header gesendet wurden (z. B. eigener Redirect/Content-Type), Layout überspringen
if (headers_sent()) {
$skipLayout = true;
}
if (!$skipLayout) { if (!$skipLayout) {
tpl('layout_start', 'structure'); tpl('layout_start', 'structure');
} }
require $target; echo $content;
if (!$skipLayout) { if (!$skipLayout) {
tpl('layout_end', 'structure'); tpl('layout_end', 'structure');
} }