This commit is contained in:
2025-12-10 01:40:05 +01:00
parent 10cc7b5d30
commit 8b5004b292
14 changed files with 374 additions and 100 deletions

View File

@@ -1,27 +1,38 @@
<?php
require_once __DIR__ . '/../../inc/helpers.php';
$layoutScripts = $layoutScripts ?? [];
if (!is_array($layoutScripts)) {
$layoutScripts = [$layoutScripts];
}
foreach ($layoutScripts as $script) {
if (is_string($script)) {
$script = trim($script);
if ($script === '') {
continue;
}
tpl_add_script($script);
continue;
}
if (!is_array($script) || empty($script['src'])) {
continue;
}
tpl_add_script(
(string)$script['src'],
$script['pos'] ?? 'footer',
!empty($script['defer']),
!empty($script['async']),
(string)($script['type'] ?? ''),
$script['version'] ?? null,
!empty($script['module'])
);
}
?>
<?php require __DIR__ . '/footer.php'; ?>
<?php foreach ($layoutScripts as $script): ?>
<?php if (is_string($script)): ?>
<?= $script . PHP_EOL ?>
<?php elseif (is_array($script) && isset($script['src'])): ?>
<?php
$attrs = [];
if (!empty($script['defer'])) {
$attrs[] = 'defer';
}
if (!empty($script['module'])) {
$attrs[] = 'type="module"';
} elseif (!empty($script['type'])) {
$attrs[] = 'type="' . htmlspecialchars($script['type'], ENT_QUOTES) . '"';
}
?>
<script src="<?= htmlspecialchars($script['src'], ENT_QUOTES) ?>" <?= implode(' ', $attrs) ?>></script>
<?php endif; ?>
<?php endforeach; ?>
<?php tpl_render_styles(null, 'footer'); ?>
<?php tpl_render_scripts(null, 'footer'); ?>
</body>
</html>

View File

@@ -1,5 +1,6 @@
<?php
require_once __DIR__ . '/app_config.php';
require_once __DIR__ . '/../../inc/helpers.php';
$pageTitle = $pageTitle ?? 'Email Template System';
$bodyClass = trim(($bodyClass ?? 'bg-slate-50 text-slate-800') . ' page-shell');
@@ -14,6 +15,13 @@ $sharedCss = [
app_asset_url('/assets/css/admin.css'),
app_asset_url('/assets/css/toast.css'),
];
foreach ($sharedCss as $href) {
tpl_add_style($href, 'header', 'high');
}
if ($debugRedirect) {
tpl_add_script(app_asset_url('/assets/js/debug-location.js'), 'header');
}
?>
<!doctype html>
<html lang="de">
@@ -31,12 +39,7 @@ $sharedCss = [
<?php endif; ?>
</script>
<script src="https://cdn.tailwindcss.com"></script>
<?php if ($debugRedirect): ?>
<script src="<?= app_asset_url('/assets/js/debug-location.js') ?>"></script>
<?php endif; ?>
<?php foreach ($sharedCss as $href): ?>
<link rel="stylesheet" href="<?= htmlspecialchars($href, ENT_QUOTES) ?>">
<?php endforeach; ?>
<?php tpl_render_styles(null, 'header'); ?>
<style>
.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.35rem .7rem;border-radius:.75rem;border:1px solid #e5e7eb;background:#fff;font-size:.9rem;cursor:pointer;}
.btn:hover{background:#f8fafc}
@@ -50,6 +53,7 @@ $sharedCss = [
<?php foreach ($layoutExtraHead as $snippet): ?>
<?= $snippet . PHP_EOL ?>
<?php endforeach; ?>
<?php tpl_render_scripts(null, 'header'); ?>
</head>
<body class="<?= htmlspecialchars($bodyClass) ?>" <?= $pageId ? 'data-page="' . htmlspecialchars($pageId) . '"' : '' ?>>
<?php require __DIR__ . '/header.php'; ?>