Aller au contenu principal
/**
* Page Hôtels au Pas de la Case
* Refonte Mobile-First - Février 2026
*/
// Meta données SEO
$dynamicYear = function_exists('getDynamicYear') ? getDynamicYear() : date('Y');
// Charger les hôtels
$hotelsJsonPath = __DIR__ . '/../../hotels.json';
$hotels = [];
if (file_exists($hotelsJsonPath)) {
$hotels = json_decode(file_get_contents($hotelsJsonPath), true) ?? [];
}
// Filtrer hôtels inactifs
$hotels = array_values(array_filter($hotels, fn($h) => ($h['active'] ?? true) !== false));
$hotelsCount = count($hotels);
// Tri : sponsored en premier (par featured_rank asc), puis étoiles desc, puis nom asc
usort($hotels, function($a, $b) {
$aS = $a['sponsored'] ?? false;
$bS = $b['sponsored'] ?? false;
if ($aS !== $bS) return $bS <=> $aS;
if ($aS && $bS) return ($a['featured_rank'] ?? 99) <=> ($b['featured_rank'] ?? 99);
if (($a['b_class'] ?? 0) !== ($b['b_class'] ?? 0)) return ($b['b_class'] ?? 0) <=> ($a['b_class'] ?? 0);
return strcmp($a['b_name'] ?? '', $b['b_name'] ?? '');
});
// Top 10 hôtels pour schema ItemList
$topHotels = array_slice($hotels, 0, 10);
?>