Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once(__DIR__ . '/vendor/autoload.php');
- class Test {
- public $loader;
- public $twig;
- public function __construct() {
- $this->loader = new Twig_Loader_Filesystem(__DIR, . '/templates');
- $this->twig = new Twig_Environment($this->loader);
- $this->show_page();
- }
- public function show_page() {
- $results = get_results_from_db();
- $template = $this->twig->loadTemplate('results.twig');
- $template->render([
- 'results' => $results,
- ]);
- }
- }
- {% for result in results %}
- <p>{{ result.name }}</p>
- {% endfor %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement