public static function render($path, $data = False, $extension = "tpl")
 {
     $loader_path = dirname($path);
     $template_name = end(explode("/", $path)) . "." . $extension;
     $loader = new \Twig_Loader_Filesystem("app/views/{$loader_path}");
     $twig = new \Twig_Environment($loader, array('cache' => 'cache', 'debug' => true, 'auto_reload' => true, 'strict_variables' => true, 'autoescape' => true));
     $twig->AddExtension(new \Twig_Extension_Debug());
     echo $twig->render($template_name, $data);
 }
Example #2
0
 public static function render($path, $data = [], $extension = "twig")
 {
     Twig_Autoloader::register();
     $redirect = $path . "." . $extension;
     $loader = new Twig_Loader_Filesystem(VIEW_DIR);
     $twig = new Twig_Environment($loader, array('cache' => APP_DIR . '/cache', 'debug' => true, 'auto_reload' => true, 'strict_variables' => true, 'autoescape' => true));
     $twig->AddExtension(new \Twig_Extension_Debug());
     echo $twig->render($redirect, $data);
 }