mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Update usage.md
This commit is contained in:
parent
397e05b01a
commit
558cafc1fe
@ -3,31 +3,31 @@ Basic usage
|
|||||||
|
|
||||||
### Initialize Fenom
|
### Initialize Fenom
|
||||||
|
|
||||||
Use factory method
|
Creating an object via factory method
|
||||||
```php
|
```php
|
||||||
$fenom = Fenom::factory('/path/to/templates', '/path/to/compiled/template', $options);
|
$fenom = Fenom::factory('/path/to/templates', '/path/to/compiled/template', $options);
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `new` operator
|
Creating an object via `new` operator
|
||||||
```php
|
```php
|
||||||
$fenom = new Fenom(new Provider('/path/to/templates'));
|
$fenom = new Fenom(new Provider('/path/to/templates'));
|
||||||
$fenom->setCompileDir('/path/to/template/cache');
|
$fenom->setCompileDir('/path/to/template/cache');
|
||||||
$fenom->setOptions($options);
|
$fenom->setOptions($options);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Render template
|
### Rendering template
|
||||||
|
|
||||||
Output template
|
Output template
|
||||||
```php
|
```php
|
||||||
$fenom->display("template/name.tpl", $vars);
|
$fenom->display("template/name.tpl", $vars);
|
||||||
```
|
```
|
||||||
|
|
||||||
Get template into the variable
|
Get the result of rendering the template
|
||||||
```php
|
```php
|
||||||
$result = $fenom->fetch("template/name.tpl", $vars);
|
$result = $fenom->fetch("template/name.tpl", $vars);
|
||||||
```
|
```
|
||||||
|
|
||||||
Create pipe-line into callback
|
Create the pipeline of rendering into callback
|
||||||
```php
|
```php
|
||||||
$fenom->pipe(
|
$fenom->pipe(
|
||||||
"template/sitemap.tpl",
|
"template/sitemap.tpl",
|
||||||
|
Loading…
Reference in New Issue
Block a user