PHP code example of lsolesen / php-template

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

    

lsolesen / php-template example snippets


    $path = './templates/';

    tpl = new Template($path);
    $tpl->set('title', 'User List');
    $body = new Template($path);
    $body->set('user_list', fetch_user_list());
    $tpl->set('body', $body->fetch('user_list.tpl.php'));
    echo $tpl->fetch('index.tpl.php');