From b86d6129c3208ae25959e87668a9fef356254e17 Mon Sep 17 00:00:00 2001 From: WOBBLEFANG THE THIRD Date: Tue, 21 Apr 2026 22:13:50 +0200 Subject: [PATCH] moved templatePath into constructor --- src/Controller/BaseController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controller/BaseController.php b/src/Controller/BaseController.php index 167323a..9f63ed2 100644 --- a/src/Controller/BaseController.php +++ b/src/Controller/BaseController.php @@ -3,11 +3,15 @@ namespace src\Controller; abstract class BaseController { + public function __construct( + string $templatePath = __DIR__ . '/../../templates/' + ) {} + protected function render(string $view, array $data = []): void { extract($data); - $viewPath = __DIR__ . '/../../templates/' . $view . '.php'; + $viewPath = $this->templatePath . '/' . $view . '.php'; if (!file_exists($viewPath)) { http_response_code(500);