PHP code example of lucid / template

1. Go to this page and download the library: Download lucid/template 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/ */

    

lucid / template example snippets




use Lucid\Template\Engine;
use Lucid\Template\Loader\FilesystemLoader;

$engine = new Engine(new Loader(['path/to/templates']));

$engine->render('partials/content.php', ['title' => 'Hello World!']);


<html>
    <body>

    <div id="container">
        $view->insert('partials/footer.php');
        $view->insert('partials/content.php');
        $view->insert('partials/footer.php');
    </div>

    </body>
</html>


<?= $view->extend('master.php') 

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <title><?= $title 



$view->addListener('head.php', new RenderHeadListener($headerData));



use Lucid\Template\Listener\ListenerInterface;

class RenderHeadListener implements ListenerInterface
{
	private $data;

	public function __construct(array $headerData)
	{
		$this->data = $data;
	}

    public function onRender(TemplateDataInterface $data)
	{
		// add header data to `$data`
	}
}

php >= 5.6