index.php 704 Bytes
Newer Older
Webserver User's avatar
Webserver User committed
1 2 3 4 5
<?
require __DIR__ . '/globals/header.php';
require __DIR__ . '/globals/settings.php';
require __DIR__ . '/vendor/autoload.php';

6 7
// create the page object by uri
$page = new simple\MVC($_SERVER["REQUEST_URI"]);
Webserver User's avatar
Webserver User committed
8

Webserver User's avatar
Webserver User committed
9
# show info about the $page object
10
#var_dump($page);die();
Webserver User's avatar
Webserver User committed
11

12
// routing to 404, if the page not found
Webserver User's avatar
Webserver User committed
13
if ($page->view->path === false) : header('Location: '.'/notFound'); endif;
Webserver User's avatar
Webserver User committed
14

Webserver User's avatar
1.0.4  
Webserver User committed
15 16 17 18 19 20 21 22 23
// build view controller and call the page action
$controller = $page->controller->namespace . $page->controller->name;
$action = $page->controller->action;

// call the action
$view = new $controller;
$view->$action($page);

// render template and view
Webserver User's avatar
Webserver User committed
24 25 26
require($page->template); 


Webserver User's avatar
Webserver User committed
27 28