$jsonFilePath<\n"; echo "CWD inside class: " . getcwd() . "\n"; echo "Debugging" ; # debug process echo "Current working dir is " . getcwd() . "\n"; if (!file_exists($jsonFilePath)) { die("json not found at $jsonFilePath ") ; } echo "file found" ; if (!is_readable($jsonFilePath)) { die("json is not readable at $jsonFilePath"); } echo "reading $jsonFilePath" ; $jsonData = json_decode($jsonData, true) ; if ($jsonData == null) { die("Couldnt decode json" . json_last_error_msg()) ; } echo "json decoded succesfully " ; echo "Testing absolute path inside class: " . $jsonFilePath . "\n"; if (!file_exists($jsonFilePath)) { die("JSON file not found at $jsonFilePath\n"); } if (!file_exists($jsonFilePath)) { echo("JSON file not found."); } $jsonData = json_decode(file_get_contents($jsonFilePath), true); if (!$jsonData) { die("Invalid JSON format."); } return $this->buildHtml($jsonData); } private function buildHtml($data) { $html = "\n\n"; if (isset($data['head'])) { $html .= $this->parseHead($data['head']); } if (isset($data['body'])) { $html .= "
\n" . $this->parseContent($data['body']['content']) . "\n\n"; } $html .= ""; return $html; } private function parseHead($headData) { $html = "\n"; // Title if (isset($headData['title'])) { $html .= "