Added: MVC structure, Router, Views and Controllers for home page and login/signup

This commit is contained in:
2024-12-25 23:02:09 +01:00
parent 7b4b349816
commit 3144078860
17 changed files with 167 additions and 0 deletions

17
core/View.php Normal file
View File

@ -0,0 +1,17 @@
<?php
class View
{
public function render($view, $data = [], $layout = 'base')
{
// Extract variables to be accessible in the view
extract($data);
// Capture the view content
ob_start();
require_once views . $view . '.php';
$content = ob_get_clean();
// Include the base layout and inject the view content
require_once views . "layouts/$layout.php";
}
}