1. Go to this page and download the library: Download tpawl/lite 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/ */
tpawl / lite example snippets
$settings = [
$template, // a string holding the template
['the' => 'variables', 'go' => 'here'],
'/path/to/view_helpers',
'view_helpers\namespace',
];
$templateExpression = new TPawl\LiTE\Expressions\TemplateExpression($settings);
$templateExpression->display();
// HelloViewHelper.php
class HelloViewHelper implements TPawl\LiTE\ViewHelperInterface
{
public static function execute(array $arguments): void
{
print 'Hello world.';
}
}
use TPawl\LiTE\Expressions\SubTemplateExpression;
class ExampleViewHelper implements TPawl\LiTE\ViewHelperInterface
{
public static function execute(array $arguments): void
{
$condition = $arguments[0];
if ($condition) {
$subTemplateExpression = new SubTemplateExpression(
$templateA, ['the' => 'variables', 'go' => 'here']);
$subTemplateExpression->display();
} else {
$subTemplateExpression = new SubTemplateExpression(
$templateB, ['the' => 'variables', 'go' => 'here']);
$subTemplateExpression->display();
}
}
}