added session, moved twig, updated base
This commit is contained in:
@@ -2,21 +2,12 @@
|
||||
require_once(BASEPATH . '/vendor/autoload.php');
|
||||
require_once(BASEPATH . '/App/config.php');
|
||||
|
||||
//Twig
|
||||
function view($name = '', $data = [] ) {
|
||||
$loader = new Twig\Loader\FilesystemLoader(BASEPATH . '/App/views/');
|
||||
$loader->addPath(BASEPATH . '/vendor/4lt/novaconium/twig', 'novaconium');
|
||||
$loader->addPath(BASEPATH . '/App/templates', 'override');
|
||||
$twig = new Twig\Environment($loader);
|
||||
//check if file exists
|
||||
if (file_exists(BASEPATH . '/App/views/' . $name . '.html.twig')) {
|
||||
echo $twig->render("$name" . '.html.twig', $data);
|
||||
return true;
|
||||
} else {
|
||||
echo "Error: Twig Template ($name) Not Found.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Creates twig and the view() function
|
||||
require_once(BASEPATH . '/vendor/4lt/novaconium/src/twig.php');
|
||||
|
||||
// Start a Session
|
||||
require_once(BASEPATH . '/vendor/4lt/novaconium/src/Session.php');
|
||||
$session = new Session();
|
||||
|
||||
// Load Database Class
|
||||
require_once(BASEPATH . '/vendor/4lt/novaconium/src/Database.php');
|
||||
@@ -27,3 +18,6 @@ require_once(BASEPATH . '/vendor/4lt/novaconium/src/Router.php');
|
||||
$router = new Router();
|
||||
//$router->debug();
|
||||
require_once($router->controllerPath);
|
||||
|
||||
//write the session
|
||||
$session->write();
|
||||
Reference in New Issue
Block a user