mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Extract shared public <head> partial
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).
This commit is contained in:
@@ -61,27 +61,10 @@ try {
|
||||
|
||||
$currentNav = 'repertoire';
|
||||
$searchBarValue = $_GET['query'] ?? '';
|
||||
$pageTitle = 'Répertoire – Posterg';
|
||||
$extraCss = ['assets/search.css'];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Répertoire – Posterg</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
|
||||
<link rel="stylesheet" href="assets/modern-normalize.min.css">
|
||||
<link rel="stylesheet" href="assets/common.css">
|
||||
<link rel="stylesheet" href="assets/search.css">
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<script>
|
||||
(function poll() {
|
||||
fetch('/live-reload.php').then(r=>r.json()).then(d=>{
|
||||
if(d.changed) location.reload(); else setTimeout(poll,1000);
|
||||
}).catch(()=>setTimeout(poll,2000));
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<?php include APP_ROOT . '/templates/public/head.php'; ?>
|
||||
<body class="search-body">
|
||||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user