fenom/docs/settings.md

47 lines
2.0 KiB
Markdown
Raw Normal View History

2013-09-29 23:52:48 +04:00
Settings
========
2013-09-29 23:52:48 +04:00
### Template cache
```php
2013-06-28 11:53:53 +04:00
$fenom->setCompileDir($dir);
```
2013-09-29 23:52:48 +04:00
This method set the name of the directory where template caches are stored. By default this is `/tmp`. This directory must be writeable.
2013-02-20 18:02:18 +04:00
### Template settings
```php
2013-02-19 09:51:33 +04:00
// set options using factory
2013-06-28 11:53:53 +04:00
$fenom = Fenom::factory($tpl_dir, $compile_dir, $options);
2013-02-19 09:51:33 +04:00
// or inline using method setOptions
2013-06-28 11:53:53 +04:00
$fenom->setOptions($options);
```
2014-01-28 21:49:35 +04:00
Options may by associative array like `'option_name' => true` or bitwise mask.
2013-02-19 09:51:33 +04:00
2014-01-28 21:44:24 +04:00
| Code | Constant | Description | Affect |
| ---------------------- | ------------------------- | ------------ | ------- |
2014-01-28 21:46:23 +04:00
| *disable_methods* | `Fenom::DENY_METHODS` | disable calling methods of objects in templates. | |
| *disable_native_funcs* | `Fenom::DENY_INLINE_FUNCS`| disable calling native function in templates, except allowed. | |
2014-01-28 21:49:35 +04:00
| *auto_reload* | `Fenom::AUTO_RELOAD` | reload template if source will be changed | decreases performance |
2014-01-28 21:46:23 +04:00
| *force_compile* | `Fenom::FORCE_COMPILE` | recompile template every time when the template renders | greatly decreases performance |
| *disable_cache* | `Fenom::DISABLE_CACHE` | disable compile cache | greatly decreases performance |
| *force_include* | `Fenom::FORCE_INCLUDE` | paste template body instead of include-tag | increases performance, increases cache size |
| *auto_escape* | `Fenom::AUTO_ESCAPE` | html-escape each variables outputs | decreases performance |
| *force_verify* | `Fenom::FORCE_VERIFY` | check existence every used variable | decreases performance |
| *auto_trim* | `Fenom::AUTO_TRIM` | remove space-characters before and after tags | |
| *disable_statics* | `Fenom::DENY_STATICS` | disable calling static methods in templates. | |
2013-02-19 09:51:33 +04:00
```php
2013-06-28 11:53:53 +04:00
$fenom->setOptions(array(
2013-02-19 09:51:33 +04:00
"compile_check" => true,
"force_include" => true
));
// same
2013-06-28 11:53:53 +04:00
$fenom->setOptions(Fenom::AUTO_RELOAD | Fenom::FORCE_INCLUDE);
2013-07-07 02:00:02 +04:00
```
2014-01-08 01:05:52 +04:00
**By default all options disabled**
2013-07-20 21:28:29 +04:00