Go to file
2013-08-05 19:30:33 +04:00
benchmark Update to 1.1 2013-07-22 18:03:43 +04:00
docs Add string concatenation (#3) 2013-08-03 18:56:17 +04:00
src Done #28 2013-08-05 13:07:16 +04:00
tests Back tests to php 5.3 2013-08-05 19:29:11 +04:00
.gitignore Fix: comments parsing 2013-05-30 23:23:22 +04:00
.travis.yml Remove PHP 5.2 from travis.yml 2013-03-15 01:28:39 +04:00
authors.md Update authors.md 2013-07-04 01:48:54 +04:00
CHANGELOG.md Done #28 2013-08-05 13:07:16 +04:00
composer.json Add recursive macros support (#28) 2013-07-29 14:53:21 +04:00
license.md Add licenses 2013-04-28 18:08:57 +04:00
phpunit.xml.dist Fix: comments parsing 2013-05-30 23:23:22 +04:00
README.md Upd build status link 2013-08-05 19:30:33 +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);