Skip to content

Commit

Permalink
Merge pull request #82 from up9cloud/master
Browse files Browse the repository at this point in the history
add render by string example.
  • Loading branch information
akrabat committed Sep 20, 2017
2 parents d037f64 + 8ab95da commit fa1d747
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ $app->get('/hello/{name}', function ($request, $response, $args) {
]);
})->setName('profile');

// Render from string
$app->get('/hi/{name}', function ($request, $response, $args) {
$str = $this->view->fetchFromString('<p>Hi, my name is {{ name }}.</p>', [
'name' => $args['name']
]);
$response->getBody()->write($str);
return $response;
});

// Run app
$app->run();
```
Expand Down

0 comments on commit fa1d747

Please sign in to comment.