Compare commits

...

2 Commits

Author SHA1 Message Date
cheeseburger 702803d982 again?! 2026-04-21 22:14:19 +02:00
cheeseburger b86d6129c3 moved templatePath into constructor 2026-04-21 22:13:50 +02:00
+5 -1
View File
@@ -3,11 +3,15 @@ namespace src\Controller;
abstract class BaseController abstract class BaseController
{ {
public function __construct(
protected string $templatePath = __DIR__ . '/../../templates/'
) {}
protected function render(string $view, array $data = []): void protected function render(string $view, array $data = []): void
{ {
extract($data); extract($data);
$viewPath = __DIR__ . '/../../templates/' . $view . '.php'; $viewPath = $this->templatePath . '/' . $view . '.php';
if (!file_exists($viewPath)) { if (!file_exists($viewPath)) {
http_response_code(500); http_response_code(500);