Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <?php
  2. require_once('vendor/autoload.php');
  3.  
  4. $loader = new Twig_Loader_Filesystem(__DIR__.'/templates');
  5. $twig = new Twig_Environment($loader, array(
  6. 'cache' => __DIR__.'/cache'
  7. ));
  8.  
  9. function twig($templateFile, $context) {
  10. global $twig;
  11.  
  12. $template = $twig->load($templateFile);
  13. return $template->render($context);
  14. }
  15.  
  16. echo twig('hello.html.twig', array('name' => 'world'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement