Go to file
2013-07-07 01:46:09 +04:00
benchmark Add checking nested level for {use} and {extends} 2013-07-02 11:07:33 +04:00
docs Update articles.md 2013-07-07 01:46:09 +04:00
src Merge remote-tracking branch 'origin/master' 2013-07-07 01:36:24 +04:00
tests Add tests for auto escaping 2013-07-07 01:34:19 +04:00
.gitignore
.travis.yml
authors.md Update authors.md 2013-07-04 01:48:54 +04:00
CHANGELOG.md Fix: static modifier doesn't insert as is 2013-07-04 10:56:21 +04:00
composer.json Add checking nested level for {use} and {extends} 2013-07-02 11:07:33 +04:00
license.md
phpunit.xml.dist
README.md Update docs 2013-07-07 01:34:37 +04:00

Fenom - Template Engine for PHP

Composer package: {"fenom/fenom": "dev-master"}. See on Packagist.org

Build Status

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