1. Go to this page and download the library: Download irfantoor/template-engine 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/ */
irfantoor / template-engine example snippets
$te = new IrfanTOOR\TemplateEngine([
'max_depth' => 3, # defaults to 3
'base_path' => 'your/path/to/template/files/',
]);
{# its a comment!}
{#anything here including the external brackets are removed from the output}
{@{@echo date('d-m-Y')}
{@if ($list):}
# Note: you can use the curley brackets, so use the form foreach (...): endforeach instead
{@foreach ($list as $k => $v):}
data provided is : {$k} | {$v}
{@endforeach}
{@endif}
# you can define the data in the template
{@ $d = date('d-m-Y')}
# and prints ...
date : {$d}
# Note: The statement in {@ ...} tags need not to be terminated with a semicolon ';'
{@ $list = [
'black',
'white'
]}
dump list:
# Note: The variable to dump, might as well be an object, array, bool int or a string
{$list}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.