Last active
January 26, 2016 22:12
-
-
Save geggleto/1599f2ab5563398ed847 to your computer and use it in GitHub Desktop.
slim 3 gist 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Let's configure it. | |
| // Fetch DI Container | |
| $container = $app->getContainer(); | |
| // Register Twig View helper and configure it | |
| $container['view'] = function ($c) { | |
| //You can change this as you want | |
| $view = new \Slim\Views\Twig('templates', [ | |
| 'cache' => false //or specify a cache directory | |
| ]); | |
| // Instantiate and add Slim specific extension | |
| $view->addExtension(new Slim\Views\TwigExtension( | |
| $c['router'], | |
| $c['request']->getUri() | |
| )); | |
| return $view; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment