addPath(FRAMEWORKPATH . '/twig', 'novaconium'); $loader->addPath(FRAMEWORKPATH . '/views', 'novacore'); $loader->addPath(BASEPATH . '/App/templates', 'override'); $twig = new Twig\Environment($loader); // Add config to Twig globally $twig->addGlobal('config', $config); // Check if the template exists if (file_exists(BASEPATH . '/App/views/' . $name . '.html.twig')) { 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."; return false; } }