Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function render() |
||
38 | { |
||
39 | // We want to render the specified Twig template to the output buffer. |
||
40 | // The simplest way to do that is Slim::render, but that is not allowed |
||
41 | // in middleware, because it uses Slim\View::display which prints |
||
42 | // directly to the native PHP output buffer. |
||
43 | // Doing that is problematic, because the HTTP headers set via $app->response() |
||
44 | // must be output first, which won't happen until after the middleware |
||
45 | // is completed. Output of headers and body is done by the Slim::run entry point. |
||
46 | |||
47 | // The below is copied from Slim::render (slim/[email protected]). |
||
48 | // Modified to use View::fetch + Response::write, instead of View::display. |
||
49 | $this->app->view->appendData($this->_templateVars); |
||
50 | $body = $this->app->view->fetch($this->_template); |
||
51 | $this->app->response->write($body); |
||
52 | } |
||
53 | |||
55 |