' . htmlspecialchars($dataValue) . '

' . lang(htmlspecialchars($labelLang)) . '

'; } // Load default data from JSON file $defaultDataFile = 'device_cards_defaults.json'; $defaultData = file_exists($defaultDataFile) ? json_decode(file_get_contents($defaultDataFile), true) : []; // Decode raw JSON input from body $requestBody = file_get_contents('php://input'); $data = json_decode($requestBody, true); // Debugging logs if (json_last_error() !== JSON_ERROR_NONE) { error_log('JSON Decode Error: ' . json_last_error_msg()); error_log('Raw body: ' . $requestBody); $data = null; } // Extract 'items' or fall back to default data $items = isset($data['items']) ? $data['items'] : $defaultData; // Generate HTML $html = '
'; foreach ($items as $item) { $html .= renderSmallBox($item); } $html .= '
'; // Output generated HTML echo $html; exit(); ?>