1. Go to this page and download the library: Download lkt/templates 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/ */
lkt / templates example snippets
<div> echo $title;
use Lkt\Templates\Template;
// Create a template instance:
$template = Template::file('layout.phtml'); // You can set a relative path, but absolute path it's allowed too
// Feed the data
$template->setData([
'title' => 'Hello from LKT Templates!',
'data' => [1,2]
]);
// If you want to, you can add more data with:
$template->set('favouriteDrink', 'Apple juice'); // PEGI 3+ example
// Parse the layout
$html = $template->parse(); // String returned
// And now you can just print the html or do whatever you want to do with that string
echo $html;
// Alternatively, you can just print the template, and it will be automatically parsed:
echo $template; // equal to echo $template->parse();