Big Update Added Services and Admin

This commit is contained in:
2025-06-22 11:26:57 -07:00
parent 8f462953b7
commit caca552cae
32 changed files with 683 additions and 46 deletions

View File

@@ -1,11 +1,16 @@
<?php
//Twig
function view($name = '', $data = []) {
global $config; // Use the globally included $config
function view($name = '', $moreData = []) {
global $config, $data; // Use the globally included $config
if (!empty($moreData)){
$data = array_merge($data, $moreData);
}
$loader = new Twig\Loader\FilesystemLoader(BASEPATH . '/App/views/');
$loader->addPath(BASEPATH . '/vendor/4lt/novaconium/twig', 'novaconium');
$loader->addPath(FRAMEWORKPATH . '/twig', 'novaconium');
$loader->addPath(FRAMEWORKPATH . '/views', 'novacore');
$loader->addPath(BASEPATH . '/App/templates', 'override');
$twig = new Twig\Environment($loader);
@@ -15,7 +20,10 @@ function view($name = '', $data = []) {
// Check if the template exists
if (file_exists(BASEPATH . '/App/views/' . $name . '.html.twig')) {
echo $twig->render("$name.html.twig", $data);
echo $twig->render($name . '.html.twig', $data);
return true;
} elseif (str_starts_with($name, '@')) { // Check if using framework
echo $twig->render($name . '.html.twig', $data);
return true;
} else {
echo "Error: Twig Template ($name) Not Found.";