mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
c76f5c8be0
Add more docs
775 B
775 B
Basic usage
Initialize Fenom
Use factory method
$fenom = Fenom::factory('/path/to/templates', '/path/to/compiled/template', $options);
Use new
operator
$fenom = new Fenom(new Provider('/path/to/templates'));
$fenom->setCompileDir('/path/to/template/cache');
$fenom->setOptions($options);
Render template
Output template
$fenom->display("template/name.tpl", $vars);
Get template into the variable
$result = $fenom->fetch("template/name.tpl", $vars);
Create pipe-line into callback
$fenom->export(
"template/sitemap.tpl",
$vars,
$callback = [new SplFileObject("/tmp/sitemap.xml", "w"), "fwrite"], // pipe to file /tmp/sitemap.xml
$chunk_size = 1e6 // chunk size for callback
);