Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Signed-off-by: Fery Wardiyanto <ferywardiyanto@gmail.com>
  • Loading branch information
feryardiant committed Nov 6, 2015
1 parent 52be00d commit 2e3e6f6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ $container->register(new \Projek\Slim\PlatesProvider);

// Option 2, using Closure
$container['view'] = function ($c) {
$view = new \Projek\Slim\Plates([
$settings = [
// Path to view directory
'directory' => 'path/to/views',
// Path to asset directory
'assetPath' => 'path/to/static/assets',
// Template extension (default: 'php')
'fileExtension' => 'tpl',
]);
];
$view = new \Projek\Slim\Plates($settings);

// Instantiate and add Slim specific extension
$view->loadExtension(
Expand All @@ -54,13 +58,13 @@ $app->get('/hello/{name}', function ($request, $response, $args) {
$app->run();
```

**NOTE**: if you are using _option 1_ please make sure you already have `$container['settings']['plates']` in your configuration file.
**NOTE**: if you are using _option 1_ please make sure you already have `$container['settings']['view']` in your configuration file.

## Custom template functions

This component exposes a custom `$this->pathFor()` function to your Plates templates. You can use this function to generate complete URLs to any Slim application named route. This is an example Plates template:

```html
```php
<?php $this->layout('base-template') ?>

<?php $this->start('body') ?>
Expand All @@ -82,7 +86,8 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits

- [Fery Wardiyanto](http://feryardiant.me)
- [Slim Framework](http://www.slimframework.com/)
- [Slim Framework](http://www.slimframework.com)
- [Plates Template](http://platesphp.com)

## License

Expand Down

0 comments on commit 2e3e6f6

Please sign in to comment.