dev-master
9999999-devExtra pack for Fenom
BSD-3
The Requires
- php >5.4.8
- fenom/fenom 2.*
The Development Requires
by Ivan Shalganov
extra fenom add-ons
Wallogit.com
2017 © Pedro Peláez
Extra pack for Fenom
Extra add-ons pack for Fenom template engine., (*1)
Composer package:
{"fenom/extra": "dev-master"}. See on Packagist.org, (*2)
The library is a collection of add-ons. Each add-on present as trait. This realization allow create your template engine with custom collection of add-ons.
Also library contain class Fenom\Extra - template engine which include all add-ons and ready out of the box., (*4)
Use class Fenom\Extra instead of Fenom:, (*5)
$fenom = Fenom\Extra::factory($template_dir, $compiled_dir, $options);
Or combine your own templater:, (*6)
For example:, (*7)
class Templater extends \Fenom {
use \Fenom\StorageTrait, // add internal storage of variables
\Fenom\LoaderTrait, // allow add yours loaders for modifiers and tags
\Fenom\PluginLoaderTrait; // add loader for modifiers and tags in Smarty-like style
// ...
}
All add-ons implemented in class \Fenom\Extra., (*8)
Add-on: Fenom\StorageTrait, (*9)
<?php
$fenom->assign("var_name", $value);
$fenom->assignByRef("var_name", $value);
$fenom->append("var_name", $value);
$fenom->prepend("var_name", $value);
$vars = $fenom->getVars();
$fenom->assignVars($vars);
$fenom->resetVars();
$fenom->pipe($template_name, $callback);
$fenom->fetch($template_name);
$fenom->display($template_name);
Add-on: Fenom\LoaderTrait, (*10)
Add-on: Fenom\SimpleLoaderTrait
Require: Fenom\LoaderTrait, (*11)
<?php $fenom->addPluginsDir($path);
Add-on: Fenom\SmartyTrait
Require: Fenom\SimpleLoaderTrait, (*12)
<?php $fenom->setSmartySupport(); // enable smarty syntax support
Supported:, (*13)
{func var="test `$foo[0]` test"}
$smarty (without section data)assign
foreach
section
math
Todo:, (*14)
{func var="test {counter} test"}
$smarty with section dataExtra pack for Fenom
BSD-3
extra fenom add-ons