Files
alba-zochling/components/content.php
T
2026-09-15 13:25:48 +02:00

15 lines
420 B
PHP

<?php
function az_content(string $rel): array {
static $cache = [];
if (!isset($cache[$rel])) {
$file = $_SERVER['DOCUMENT_ROOT'] . '/content/' . $rel;
$data = json_decode((string) file_get_contents($file), true);
if (!is_array($data)) {
http_response_code(500);
exit('Content file missing or invalid: ' . htmlspecialchars($rel));
}
$cache[$rel] = $data;
}
return $cache[$rel];
}