Go to file
evseevnn cd8e8a1bb4 Проверка на строку не нужна
В регулярном выражении нет необходимости указывать "^", так как .* заякоривается автоматом.
2013-12-21 15:19:20 +03:00
benchmark Done 1.4.0 2013-09-02 17:40:58 +04:00
docs Fix composer version 2013-10-02 10:36:33 +04:00
src Проверка на строку не нужна 2013-12-21 15:19:20 +03:00
tests 1.4.8 2013-12-01 19:30:09 +04:00
.coveralls.yml Add coveralls 2013-09-12 19:59:20 +04:00
.gitignore Fix AUTO_RELOAD option 2013-08-23 00:55:53 +04:00
.travis.yml Add coveralls 2013-09-12 19:59:20 +04:00
authors.md Update authors.md 2013-07-04 01:48:54 +04:00
CHANGELOG.md 1.4.8 2013-12-01 19:30:09 +04:00
composer.json Rollback phpunit to require-dev 2013-09-12 20:01:06 +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 Update README.md 2013-10-02 10:36:55 +04:00

Fenom - Template Engine for PHP

Composer package: {"fenom/fenom": "1.*"}. 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);