Go to file
bzick ad2e7316b1 Done static inheritance
Add TestCase
2013-02-15 01:49:26 +04:00
benchmark Done static inheritance 2013-02-15 01:49:26 +04:00
docs Add docs (drafts) 2013-02-13 18:51:53 +04:00
src Done static inheritance 2013-02-15 01:49:26 +04:00
tests Done static inheritance 2013-02-15 01:49:26 +04:00
.gitignore Dev, dev and dev. Also, docs, docs and docs. 2013-02-07 17:37:16 +04:00
.travis.yml Add composer to travis 2013-02-07 18:01:06 +04:00
composer.json Fix name 2013-02-08 14:53:20 +04:00
phpunit.xml.dist port 2013-01-25 18:36:16 +04:00
README.md Add docs drafts 2013-02-09 11:32:11 +04:00

Aspect PHP Template Engine

Composer package: n/a

About :: Documentation :: Benchmark :: Bugs :: Articles

Build Status

Primitive template

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

Get content

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

Runtime compilation

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