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; } }