Go to file
2013-05-30 20:03:26 +04:00
benchmark Fix: reparse close tag, custom provider, simplify compile method, add providers and tests 2013-05-30 19:00:00 +04:00
docs Fix documentation 2013-05-30 20:00:52 +04:00
src Fix: reparse close tag, custom provider, simplify compile method, add providers and tests 2013-05-30 19:00:00 +04:00
tests Fix documentation 2013-05-30 20:00:52 +04:00
.gitignore Hold folders 2013-02-20 18:01:21 +04:00
.travis.yml Remove PHP 5.2 from travis.yml 2013-03-15 01:28:39 +04:00
authors.md Add licenses 2013-04-28 18:08:57 +04:00
composer.json Add comments and license block 2013-04-28 11:33:36 +04:00
license.md Add licenses 2013-04-28 18:08:57 +04:00
phpunit.xml.dist port 2013-01-25 18:36:16 +04:00
README.md Set version for composer 2013-05-30 20:03:26 +04:00

Cytro - awesome template engine for PHP

Composer package: {"bzick/cytro": "1.*"}. See on Packagist.org

Build Status

About :: Documentation :: Benchmark :: Articles

Simple template

<html>
    <head>
        <title>Cytro</title>
    </head>
    <body>
    {if $templaters.cytro?}
        {var $tpl = $templaters.cytro}
        <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
$cytro = Cytro::factory('./templates', './compiled', Cytro::CHECK_MTIME);
$cytro->display("pages/about.tpl", $data);

Get content

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

Runtime compilation

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