Skip to content

Commit

Permalink
version up and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr-ru committed Apr 5, 2017
1 parent 3376548 commit 1ec71e8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Another simple template parser

* Blocks of markup as object
* Block repeat (setBlock appends new block and returns handle to it)
* Recursive blocks (see example below)
* Empty block placeholders
* Independent variables in blocks and main template
* Variable data escaping (filtering) in template, see markup below
Expand Down Expand Up @@ -159,6 +160,35 @@ for($i=1; $i<=3; $i++) {
$to->showOutput();
```

## Recursive blocks
Since 2.4 there is an abilty to make your blocks recursive. For example:

*recursive.html*

```
<body>
<!-- BEGIN blockname -->
[a recursive block]
<!-- RECURSION blockname -->
<!-- END blockname -->
</body>
```

The code:

```
$to = TemplateObject::loadTemplate('recursive.html');
$to->setBlock('blockname')->setBlock('blockname')->setBlock('blockname');
$to->showOutput();
```

Output:

```
[a recursive block] [a recursive block] [a recursive block]
```


## Function quick reference

### *static* loadTemplate(string $file) : TemplateObject
Expand Down
4 changes: 2 additions & 2 deletions TemplateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Based on features of HTML_Template_IT by Ulf Wendel, Pierre-Alain Joye.
*
* @author Rebel
* @copyright (c) 2016 Aleksandr.ru
* @copyright (c) 2017 Aleksandr.ru
* @link https://github.com/Aleksandr-ru/TemplateObject Project page
* @link https://pear.php.net/package/HTML_Template_IT Original HTML_Template_IT
* @link http://aleksandr.ru Author's website
*
* @version 2.3
* @version 2.4
*/
class TemplateObject
{
Expand Down

0 comments on commit 1ec71e8

Please sign in to comment.