Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('vendor/autoload.php');
- $loader = new Twig_Loader_Filesystem(__DIR__.'/templates');
- $twig = new Twig_Environment($loader, array(
- 'cache' => __DIR__.'/cache'
- ));
- function twig($templateFile, $context) {
- global $twig;
- $template = $twig->load($templateFile);
- return $template->render($context);
- }
- echo twig('hello.html.twig', array('name' => 'world'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement