PHP versions supported: 7.0, 7.1 and 7.2
Install with composer: (recommended)
composer require transfiguration/transfiguration 1.*
require 'vendor/autoload.php';
use Transfiguration\Transfiguration;
Download latest realease: here
$transfiguration = new Transfiguration;
// Setting template html
$transfiguration->html($templateHtml);
// Setting template variables
$transfiguration->data($templateData);
// Setting template base path for require and include.
$transfiguration->requirePath($templatePath);
This function is printing template html into the page.
$transfiguration->render();
This function returns executed template html.
$transfiguration->export();
This method extends Transfiguration templating engine functionality.
$transfiguration->hook("header", function($content="") {
return "<h1>{$content}</h1>";
});
usage in Transfiguration code
{{ header 'This is a header.'}}
<ul>
{{ for $key : $value in var }}
<li>{{ echo $key . " " . $value}}</li>
{{endfor}}
</ul>
{{ if $loggedin == true}}
<b>User logged in!</b>
{{ elseif $guest == true }}
<b>User is guest!</b>
{{ else }}
<b>User not logged in!</b>
{{ endif }}
{{echo "string"}}
or
{{print "string"}}
{{ include 'base/footer.html' }}
or
{{ require 'base/footer.html' }}
{{ var $varname = "varvalue" }}
{# This is a comment #}