* Doc: https://www.isn.cz/kb/doku.php/twig#first-page * */ require_once './lib/Twig/Autoloader.php'; Twig_Autoloader::register(); // loading templates, path to templates $loader = new Twig_Loader_Filesystem('./templates'); // environment options $twig = new Twig_Environment($loader, array( 'cache' => './cache', // path to compilation cache, default to false (disable caching) 'debug' => false, // default to false 'charset' => 'utf-8', // default to utf-8 'base_tamplate_class' => 'Twig_Template', // default to Twig_Template 'auto_reload' => false, // default to false 'strict_variables' => false, // default to false, false = Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a null value, true = Twig throws an exception instead 'autoescape' => 'html', // default to true, true = auto-escaping will be enabled by default for all templates, false = disable, or scaping strategy to use (html, jscss, url, html_attr) or callback 'optimizations' => -1 // default to -1, -1 = all optimizations are enabled, 0 = disabled ) ); // load template first.html $template = $twig->loadTemplate('first.twig'); // render page with this variables echo $template->render(array('firstPageTitle' => 'First Page', 'firstPageDocUrl' => 'https://www.isn.cz/kb/doku.php/twig#first-page')); ?>