diff --git a/cms/src/NeoCMS/CMSController.php b/cms/src/NeoCMS/CMSController.php index 4d744fb..50ea976 100644 --- a/cms/src/NeoCMS/CMSController.php +++ b/cms/src/NeoCMS/CMSController.php @@ -295,14 +295,18 @@ class CMSController // Load the HTML content from the file $htmlContent = file_get_contents($filePath); + if ($htmlContent === false) { + $htmlContent = file_get_contents($this->documentRoot . ltrim($filePath, '/')); + } + // Initialize a new DOMDocument object - $dom = new DOMDocument(); + $dom = new \DOMDocument(); // Suppress warnings that might occur due to malformed HTML @$dom->loadHTML($htmlContent); // Find all elements with the class "editable" - $xpath = new DOMXPath($dom); + $xpath = new \DOMXPath($dom); $editableElements = $xpath->query('//*[contains(@class, "editable")]'); // Return true if there are any elements with the "editable" class