Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2.  
  3. require_once __DIR__.'/vendor/autoload.php';
  4.  
  5. $loader = new Twig_Loader_Filesystem(__DIR__.DIRECTORY_SEPARATOR.'views');
  6. $twig = new Twig_Environment($loader);
  7. $twig->addFunction(new Twig_SimpleFunction('link', function ($value) {
  8. return sprintf('/?template=%s', $value);
  9. }));
  10.  
  11. $template = ($_GET['template'] ?: 'index');
  12.  
  13. echo $twig->render(sprintf('%s.html.twig', $template));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement