PHP code example of piotrpress / templater

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

    

piotrpress / templater example snippets




use PiotrPress\Templater;

$templater = new Templater( '/templates' );

// print
$templater->display( 'template', [
    'var1' => 'value1',
    'var2' => 'value2'
] );

// return
echo $templater->render( 'template', [
    'var1' => 'value1',
    'var2' => 'value2'
] );