diff --git a/php/controller/search-results-controller.php b/php/controller/search-results-controller.php index 136f726..2fe45fb 100644 --- a/php/controller/search-results-controller.php +++ b/php/controller/search-results-controller.php @@ -4,8 +4,21 @@ //require_once '/../model/ArticleManager.php'; //test -require_once dirname(__DIR__, 2) . '/model/LocalArticleManager.php'; -require_once dirname(__DIR__, 2) . '/model/ArticleManager.php'; +$modelPath1 = dirname(__DIR__, 2) . '/model/LocalArticleManager.php'; +$modelPath2 = dirname(__DIR__, 2) . '/model/ArticleManager.php'; + +if (file_exists($modelPath1) && file_exists($modelPath2)) { + include_once $modelPath1; + include_once $modelPath2; +} else { + // Falls die Pfade falsch berechnet wurden, stürzt die Seite nicht ab, sondern zeigt das an: + echo "
"; + echo "Controller-Fehler: Die Model-Dateien wurden nicht gefunden.
"; + echo "Gesuchter Pfad 1: " . htmlspecialchars($modelPath1) . "
"; + echo "Gesuchter Pfad 2: " . htmlspecialchars($modelPath2) . ""; + echo "
"; +} + if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {