mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Create templates/public/head.php accepting $pageTitle and $extraCss (array of stylesheet hrefs), mirroring the existing templates/admin/head.php pattern. The partial emits: DOCTYPE, <html lang=fr>, charset/viewport meta, favicon, modern-normalize, common.css, any extra CSS links, and the dev-only live-reload script. The live-reload snippet was previously copy-pasted verbatim into all five public pages. Updated pages: - public/index.php ($pageTitle='Posterg', $extraCss=['assets/main.css']) - public/search.php ($pageTitle='Répertoire – Posterg', search.css) - public/tfe.php ($pageTitle=thesis title + suffix, tfe.css) - public/apropos.php ($pageTitle='À Propos – Posterg', apropos.css) - public/licence.php ($pageTitle=DB title + suffix, apropos.css) tfe.php: removed redundant htmlspecialchars() call on $pageTitle (the partial applies it); licence.php: renamed conflicting $page variable to $dbPage to avoid collision with the shared $pageTitle expected by the partial. All syntax checks and test suite pass (4/4).
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
||
require_once __DIR__ . '/../config/bootstrap.php';
|
||
require_once APP_ROOT . '/src/Database.php';
|
||
require_once APP_ROOT . '/src/Parsedown.php';
|
||
|
||
$currentNav = 'licence';
|
||
|
||
try {
|
||
$db = Database::getInstance();
|
||
$dbPage = $db->getPage('licenses');
|
||
$content = $dbPage ? $dbPage['content'] : '';
|
||
$licencePageTitle = $dbPage ? $dbPage['title'] : 'Licences';
|
||
} catch (Exception $e) {
|
||
error_log("Error loading licence page: " . $e->getMessage());
|
||
$content = '';
|
||
$licencePageTitle = 'Licences';
|
||
}
|
||
|
||
$pd = new Parsedown();
|
||
$pd->setSafeMode(true);
|
||
$html = $pd->text($content);
|
||
|
||
$pageTitle = $licencePageTitle . ' – Posterg';
|
||
$extraCss = ['assets/apropos.css'];
|
||
?>
|
||
<?php include APP_ROOT . '/templates/public/head.php'; ?>
|
||
<body class="apropos-body">
|
||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||
|
||
<?php include APP_ROOT . '/templates/nav.php'; ?>
|
||
<?php include APP_ROOT . '/templates/search-bar.php'; ?>
|
||
|
||
<main class="apropos-main" id="main-content">
|
||
<div class="apropos-description apropos-page-content apropos-single">
|
||
<?php if (!empty(trim($content))): ?>
|
||
<?= $html ?>
|
||
<?php else: ?>
|
||
<p>Contenu à venir.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
</main>
|
||
|
||
</body>
|
||
</html>
|