2017 © Pedro Peláez
 

library extra

Extra pack for Fenom

image

fenom/extra

Extra pack for Fenom

  • Saturday, September 20, 2014
  • by bzick
  • Repository
  • 4 Watchers
  • 9 Stars
  • 630 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 1 Versions
  • 9 % Grown

The README.md

Add-ons for Fenom [development]

Extra add-ons pack for Fenom template engine., (*1)

Composer package: {"fenom/extra": "dev-master"}. See on Packagist.org, (*2)

Build Status, (*3)


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)

List of add-ons

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)

Storage

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);

Loader

Add-on: Fenom\LoaderTrait, (*10)

Plugin loader

Add-on: Fenom\SimpleLoaderTrait Require: Fenom\LoaderTrait, (*11)

<?php
$fenom->addPluginsDir($path);

Smarty

Add-on: Fenom\SmartyTrait Require: Fenom\SimpleLoaderTrait, (*12)

<?php
$fenom->setSmartySupport();  // enable smarty syntax support

Supported:, (*13)

  • backticks operator in quoted string: {func var="test `$foo[0]` test"}
  • global variable $smarty (without section data)
  • tag assign
  • tag foreach
  • tag section
  • tag math

Todo:, (*14)

  • invoke plugins in quoted strings: {func var="test {counter} test"}
  • global variable $smarty with section data

Assets

The Versions

20/09 2014

dev-master

9999999-dev

Extra pack for Fenom

  Sources   Download

BSD-3

The Requires

 

The Development Requires

by Ivan Shalganov

extra fenom add-ons