mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Docs++
This commit is contained in:
parent
45c9f27ae6
commit
1559adf030
43
README.md
43
README.md
@ -21,7 +21,46 @@ Fenom - Template Engine for PHP
|
|||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
If you use composer in your project then you can to install Fenom to project as package.
|
If you use composer in your project then you can to install Fenom as package.
|
||||||
However, if you are not using composer you have to configure autoloader to work with Fenom.
|
However, if you are not using composer you have to configure _autoloader_ to work with Fenom.
|
||||||
|
Fenom implements the `PSR-0` PHP standard to load classes which are located in the `src/` directory.
|
||||||
|
Templater already has own autoload-function, to register call method `Fenom::registerAutoload`:
|
||||||
|
```php
|
||||||
|
Fenom::registerAutoload();
|
||||||
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
There is two way to create Fenom instance:
|
||||||
|
|
||||||
|
* Long way: use operator `new`
|
||||||
|
* Shot way: use static factory-method
|
||||||
|
|
||||||
|
**Long way.** Create you own template provider or default provider `Fenom\Provider` (that is provider read [there](./)).
|
||||||
|
Using provider instance create Fenom instance:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$fenom = new Fenom(new Fenom\Provider($template_dir));
|
||||||
|
```
|
||||||
|
|
||||||
|
After that, set compile directory:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$fenom->setCompileDir($template_cache_dir);
|
||||||
|
```
|
||||||
|
|
||||||
|
This directory will be used for storing compiled templates, therefore it should be writable for Fenom.
|
||||||
|
Now Fenom is ready to work and now you can to configure it:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$fenom->setOptions($options);
|
||||||
|
```
|
||||||
|
|
||||||
|
**Short way.** Creating an object via factory method
|
||||||
|
|
||||||
|
```php
|
||||||
|
$fenom = Fenom::factory($template_dir, $template_cache_dir, $options);
|
||||||
|
```
|
||||||
|
|
||||||
|
Now Fenom is ready to work.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user