twig_test.php 723 B

12345678910111213
  1. <?php
  2. require_once '/usr/share/php/Twig/Autoloader.php';
  3. Twig_Autoloader::register();
  4. $loader = new Twig_Loader_Filesystem('templates/');
  5. $twig = new Twig_Environment($loader, array(
  6. 'cache' => '/tmp/',
  7. 'auto_reload' => true
  8. ));
  9. echo $twig->render('index.tpl', array('url' => array(array("url" => 'http://google.com', "urlTitle" => "google"),
  10. array("url" => 'http://gmail.com', "urlTitle" => "gmail"),
  11. array("url" => 'http://mail.ru', "urlTitle" => "Mail RU"),
  12. )));