Go to file
2014-05-06 15:27:31 +04:00
docs Update syntax.md 2014-04-24 00:04:27 +04:00
sandbox Done tag option :raw and :escape 2014-05-06 00:45:37 +04:00
src Add test depends of PHP version 2014-05-06 15:27:31 +04:00
tests Add test depends of PHP version 2014-05-06 15:25:43 +04:00
.coveralls.yml Add coveralls 2013-09-12 19:59:20 +04:00
.gitignore Fix git ignore 2014-01-20 12:33:59 +04:00
.travis.yml Add PHP 5.6 in .travis 2014-04-12 01:14:17 +04:00
authors.md Update authors.md 2013-07-04 01:48:54 +04:00
CHANGELOG.md Merge branch 'origin/master' 2014-04-10 00:11:04 +04:00
composer.json Add tag filter. Move benchmark to another project 2013-10-08 17:48:23 +04:00
license.md Add licenses 2013-04-28 18:08:57 +04:00
phpunit.xml.dist Add coveralls 2013-09-12 19:59:20 +04:00
README.md Upgrade docs 2014-04-17 23:55:05 +04:00

Fenom - Template Engine for PHP

Composer package: {"fenom/fenom": "2.*"}. See on Packagist.org

Latest Stable Version Build Status Coverage Status Total Downloads

Usage :: Documentation :: Benchmark :: Articles

Simple template

<html>
    <head>
        <title>Fenom</title>
    </head>
    <body>
    {if $templaters.fenom?}
        {var $tpl = $templaters.fenom}
        <div>Name: {$tpl.name}</div>
        <div>Description: {$tpl.name|truncate:80}</div>
        <ul>
        {foreach $tpl.features as $feature}
            <li>{$feature.name} (from {$feature.timestamp|gmdate:"Y-m-d H:i:s"})</li>
        {/foreach}
        </ul>
    {/if}
    </body>
</html>

Display template

<?php
$fenom = Fenom::factory('./templates', './compiled', Fenom::AUTO_RELOAD);
$fenom->display("pages/about.tpl", $data);

Get content

<?php
$fenom = Fenom::factory('./templates', './compiled', Fenom::AUTO_RELOAD);
$content = $fenom->fetch("pages/about.tpl", $data);

Runtime compilation

<?php
$fenom = new Fenom();
$template = $fenom->compileCode('Hello {$user.name}! {if $user.email?} Your email: {$user.email} {/if}');
$template->display($data);
// or
$content = $template->fetch($data);