KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8KB

  1. <?php
  2. /**
  3. * Twig
  4. * ~~~~
  5. *
  6. * A simple cross-language template engine.
  7. *
  8. * Usage
  9. * -----
  10. *
  11. * Using Twig in a application is straightfoward. All you have to do is to
  12. * make sure you have a folder where all your templates go and another one
  13. * where the compiled templates go (which we call the cache)::
  14. *
  15. * require 'Twig.php';
  16. * $loader = new Twig_Loader('path/to/templates', 'path/to/cache');
  17. *
  18. * After that you can load templates using the loader::
  19. *
  20. * $template = $loader->getTemplate('index.html');
  21. *
  22. * You can render templates by using the render and display methods. display
  23. * works like render just that it prints the output whereas render returns
  24. * the generated source as string. Both accept an array as context::
  25. *
  26. * echo $template->render(array('users' => get_list_of_users()));
  27. * $template->display(array('users' => get_list_of_users()));
  28. *
  29. * Custom Loaders
  30. * --------------
  31. *
  32. * For many applications it's a good idea to subclass the loader to add
  33. * support for multiple template locations. For example many applications
  34. * support plugins and you want to allow plugins to ship themes.
  35. *
  36. * The easiest way is subclassing Twig_Loader and override the getFilename
  37. * method which calculates the path to the template on the file system.
  38. *
  39. *
  40. * :copyright: 2008 by Armin Ronacher.
  41. * :license: BSD.
  42. */
  43. if (!defined('TWIG_BASE'))
  44. define('TWIG_BASE', dirname(__FILE__) . '/Twig');
  45. define('TWIG_VERSION', '0.1-dev');
  46. // the systems we load automatically on initialization. The compiler
  47. // and other stuff is loaded on first request.
  48. require TWIG_BASE . '/exceptions.php';
  49. require TWIG_BASE . '/runtime.php';
  50. require TWIG_BASE . '/api.php';