is emitted with hx-trigger="revealed": when it * scrolls into view htmx fetches the next offset and swaps itself * (outerHTML) with the next chunk of rows + a new sentinel. This keeps the * initial payload small instead of shipping all tags at once. * * When $offset > 0 the fragment returns only the rows (append mode), * because the sentinel lives inside the existing . */ require_once __DIR__ . '/../../bootstrap.php'; require_once __DIR__ . '/../../src/AdminAuth.php'; AdminAuth::requireLogin(); if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } require_once __DIR__ . '/../../src/Database.php'; const MOTSCLES_PAGE_SIZE = 25; $searchQuery = trim($_GET['q'] ?? ''); $offset = max(0, (int) ($_GET['offset'] ?? 0)); try { $db = new Database(); $tags = $db->getTagsPage($searchQuery, MOTSCLES_PAGE_SIZE, $offset); $total = $db->countTagsWithCount($searchQuery); } catch (Exception $e) { die('
Erreur : ' . htmlspecialchars($e->getMessage()) . '
'); } $hasMore = ($offset + count($tags)) < $total; $nextUrl = '/admin/contenus-motscles-fragment.php?offset=' . ($offset + MOTSCLES_PAGE_SIZE) . ($searchQuery !== '' ? '&q=' . urlencode($searchQuery) : ''); /** * Render one for a tag row. */ function render_motscles_row(array $tag): void { ?>
Chargement… 0) { foreach ($tags as $tag) { render_motscles_row($tag); } render_motscles_sentinel($hasMore, $nextUrl); return; } // ── Initial load: full wrapper ──────────────────────────────────────────── ?>
Nom TFE Associé Actions
Aucun mot-clé trouvé.