PHP code example of ahmachan / heng-phptemplate

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

    

ahmachan / heng-phptemplate example snippets


$path = '/path/to/templates/';

tpl = new Template($path);
$tpl->set('title', 'Goods List');
$body = new Template($path);
$body->set('goods', fetch_goodslist());
$tpl->set('content', $body->fetch('goodslist.tpl'));
echo $tpl->fetch('index.tpl');