1 | 2 | simandl | <?php |
2 | | | namespace Phem\Views; |
3 | | | |
4 | | | use Phem\Environment\EnvironmentManager; |
5 | | | use Twig_Environment; |
6 | | | /** |
7 | | | * |
8 | | | * @author kubapet |
9 | | | */ |
10 | | | class SimpleView extends View |
11 | | | { |
12 | | | public function display() |
13 | | | { |
14 | | | $twig = EnvironmentManager::getTwig(); |
15 | | | |
16 | | | if (!($twig instanceof Twig_Environment)) |
17 | | | die ('Twig environment unavailable'); |
18 | | | |
19 | | | try |
20 | | | { |
21 | | | echo $twig->render($this->template,$this->content->toArray()); |
22 | | | } |
23 | | | catch (Twig_Error_Loader $ex) |
24 | | | { |
25 | | | die('Template not found'); |
26 | | | } |
27 | | | } |
28 | | | } |