PHP code example of drroach / templator

1. Go to this page and download the library: Download drroach/templator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drroach / templator example snippets


Templator::load('HelloWorld', get_defined_vars());

 var_dump($_SESSION']); 

{{ foreach(array as value) }}
<a href="#">{{ value }}</a>
{{ endforeach; }}

{{ foreach(array as key => value) }}
<b>{{ key }}</b> - {{ value }}
{{ endforeach; }}

{{ foreach(emptyVariable as value) }}
<p>{{value}}</p>
{{ else: }}
<h1>emptyVariable is empty!</h1>
{{ endforeach; }}

{{ while(count < 10) }}
<h3>{{count}}</h3>
 $count++;