concerto/html-templates

An easy to use HTML (and XML) builder and template library.

v0.1 2014-04-29 18:33 UTC

README

An easy to use HTML (and XML) builder and template library.

Build Status

Install

The recommended way to install Text Expressions is through composer.

{
    "require": {
        "concerto/html-templates": "0.*"
    }
}

Usage

Set a text value:

use Concerto\HtmlTemplates\Template;

$tpl = new Template();
$tpl->openString('<p />');
$tpl('p')->set('PHP <3');

$tpl->render();
// > <p>PHP &lt;3</p>

Set a HTML value:

$tpl = new Template();
$tpl->openString('<p />');
$tpl('p')->set('PHP &lt;3', true);

$tpl->render();
// > <p>PHP &lt;3</p>

Expand a list:

$tpl = new Template();
$tpl->openString('<ol><li /></ol>');
$tpl('ol/li')->expand(['One', 'Two', 'Three!']);

$tpl->render();
// > <ol><li>One</li><li>Two</li><li>Three!</li></ol>