PHP code example of lune / template

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

    

lune / template example snippets


$templates = new \Lune\Template\Engine('path/to/templates');
$template = $templates->template('template.php');
$template->render();

$templates = new \Lune\Template\Engine('path/to/templates', ['foo'=>'bar']);
$template = $templates->template('template.php', ['foo'=>'bar']);
$template->render(['foo'=>'bar']);

$templates->registerFunction('error', function($message){
   return sprintf('<span class="error">%s</span>', $message);
});