Template
fix(pages): make page URLs and assets base-aware
Root-absolute asset paths and ?p= links broke when the site is served from a subfolder (WAMP). Screenshots from the database and avatars from creators.json go through fws_url() as well.
This commit is contained in:
7 files changed
+25
-25
No files matched your search
@@ -27,19 +27,19 @@ if ($pkg === null) {
|
||||
$title = 'Paquet introuvable | FWS Linux';
|
||||
echo '<section class="paquet-detail-page">'
|
||||
. '<p class="paquet-empty">Ce paquet n\'existe pas (il y en a ' . count($packages) . ').</p>'
|
||||
. '<a class="paquet-detail-back" href="/?p/paquets/">← Tous les paquets</a>'
|
||||
. '<a class="paquet-detail-back" href="' . e(fws_url('/?p/paquets/')) . '">← Tous les paquets</a>'
|
||||
. '</section>';
|
||||
return;
|
||||
}
|
||||
|
||||
$title = $pkg['name'] . ' | FWS Linux';
|
||||
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
|
||||
$extraJs[] = '/p/assets/js/packages-ui.js';
|
||||
$extraJs[] = fws_url('/p/assets/js/packages-ui.js');
|
||||
|
||||
$latest = $pkg['latest'] ?? null;
|
||||
?>
|
||||
<section class="paquet-detail-page">
|
||||
<a class="paquet-detail-back" href="/?p/paquets/">← Tous les paquets</a>
|
||||
<a class="paquet-detail-back" href="<?= e(fws_url('/?p/paquets/')) ?>">← Tous les paquets</a>
|
||||
|
||||
<div class="paquet-detail-hero">
|
||||
<span class="paquet-since" title="<?= !empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '' ?>"><?= e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') ?></span>
|
||||
@@ -84,7 +84,7 @@ $latest = $pkg['latest'] ?? null;
|
||||
<div class="paquet-screens-grid">
|
||||
<?php foreach ($pkg['screens'] as $screen): ?>
|
||||
<figure>
|
||||
<img src="<?= e((string) ($screen['src'] ?? '')) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
|
||||
<img src="<?= e(fws_url((string) ($screen['src'] ?? ''))) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
|
||||
<?php if (!empty($screen['caption'])): ?>
|
||||
<figcaption><?= e((string) $screen['caption']) ?> <span class="paquet-zoom-hint">— cliquez pour agrandir</span></figcaption>
|
||||
<?php else: ?>
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ if (!defined('FWS_PAGE_SHELL')) {
|
||||
|
||||
$title = 'Paquets | FWS Linux';
|
||||
$description = 'Les outils développés pour FWS Linux — historique de chaque paquet, captures d\'écran et liens utiles.';
|
||||
$extraJs[] = '/p/assets/js/packages-ui.js';
|
||||
$extraJs[] = fws_url('/p/assets/js/packages-ui.js');
|
||||
|
||||
function fws_packages_empty(string $message): string
|
||||
{
|
||||
@@ -94,7 +94,7 @@ function fws_packages_card(array $pkg, int $position): string
|
||||
. '<h2>' . e($pkg['name']) . '</h2>'
|
||||
. '<span class="paquet-since" title="' . (!empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '') . '">'
|
||||
. e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') . '</span>'
|
||||
. '<a class="paquet-detail-link" href="/?p/paquets/' . $position . '/">Voir en grand</a>'
|
||||
. '<a class="paquet-detail-link" href="' . e(fws_url('/?p/paquets/' . $position . '/')) . '">Voir en grand</a>'
|
||||
. '</div>'
|
||||
. (!empty($pkg['tagline']) ? '<p class="paquet-tagline">' . e($pkg['tagline']) . '</p>' : '')
|
||||
. '<p class="paquet-latest">' . e($latestText) . '</p>'
|
||||
|
||||
Reference in new issue
Block a user