PHP code example of bojaghi / template

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

    

bojaghi / template example snippets


use Bojaghi\Template\Template

$t = new Template(
    [
        'extensions' => ['php'],
        'infix'      => 'tmpl',
        'scopes'     => [
            plugin_dir_path(__FILE__) . '/templates',
        ],
    ],
);

use Bojaghi\Template\Template

$t = new Template('/path/to/config');

$output = $t->template('my-template', ['foo' => 'bar']);

// my-template.php 

$this->start('title'); 

$this->assign('title', '<span class="title">Ms.</span>');

// parent.php

echo $t->fragment('frag-a');