# tplBlock
A very simple PHP template class
[![Build Status](https://travis-ci.org/gnieark/tplBlock.svg?branch=master)](https://travis-ci.org/gnieark/tplBlock)
# Sample
This simple template file:
```html
{{pageTilte}}
```
Parsed with this code:
```php
add_vars(array("pageTilte" => "Poke @zigazou ;)"));
$data = array(
array(
"url" => "https://github.com/gnieark/tplBlock",
"name" => "tplBlock",
"author" => "Gnieark",
"quality" => "simple and perfect"
),
array(
"url" => "https://github.com/Zigazou/TemplateEngine",
"name" => "TemplateEngine",
"author" => "Zigazou",
"quality" => "more complex than tplBlock"
)
);
//add blocks
foreach ($data as $block){
$tplTemplateSystem = new TplBlock("templatesystem");
$tplTemplateSystem -> add_vars($block);
$tpl->add_sub_block($tplTemplateSystem);
}
//parsing:
echo $tpl->apply_tpl_file("template.html");
```
will return:
```html
Poke @zigazou ;)
```
# Conception choices
I wrote this class for use it on others personnals projects. It's really simple. I think logicals functions "OR" "IF", filtering, caching, are not the templating system matter.
If a block ( <--BEGIN .... )is in the template, but is not called, it will be deleted.
For now, class is permissive. I'll improve it to manage templating errors.
# Install
Use composer etc... or simply put the file TplBlock.php on your project https://raw.githubusercontent.com/gnieark/tplBlock/master/TplBlock.php
# Documentation
See the comments on the TplBlock.php file.