Skip to content

Commit

Permalink
Some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthes committed Jul 26, 2017
1 parent bea1ad4 commit 0ec1a10
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ code is eval'ed. So TextTemplate should be more secure than Smarty or Twig by de

TextTemplate supports infinite-nested loops and sequences.

## Basic Example
```php

// 1. Define the Template
$tplStr = <<<EOT
Hello World {= name }
{if name == "Matthias"}
Hallo {= name | capitalize }
{/if}
EOT;

// 2. Define the Data for the Template
$data = [
"name" => "Matthias"
];

// 3. Parse
$tt = new TextTemplate($tplStr);
echo $tt->apply ($data);
```


## Install

I prefer and recommend using [composer](http://getcomposer.com):
Expand All @@ -43,27 +65,6 @@ use TextTemplate. It's just one class.
_TextTemplate uses Phing to build the phar-archives and gzip them. Just execute main-target in build.xml to build your own version_


## Basic Example
```php

// 1. Define the Template
$tplStr = <<<EOT
Hello World {= name }
{if name == "Matthias"}
Hallo {= name | capitalize }
{/if}
EOT;

// 2. Define the Data for the Template
$data = [
"name" => "Matthias"
];

// 3. Parse
$tt = new TextTemplate($tplStr);
echo $tt->apply ($data);
```



## Value injection
Expand Down

0 comments on commit 0ec1a10

Please sign in to comment.