PHP code example of humming / template

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

    

humming / template example snippets




lateDir = __DIR__ . '/template';
$compiledDir = __DIR__ . '/compiled';
$cache = new Psr\SimpleCache\CacheInterface();
$container = new Psr\Container\ContainerInterface();
$template = new \Humming\Template($templateDir, $compiledDir, new \Humming\Thigh($cache, $container), new \Humming\Pagination());

$template->assign('something', $somthing);
$template->display("test");

class HighSchoolStudent extends \Humming\Widget
{
    public function getItems($limit = 10, $name = '')
    {
        return array('title' => 'Students', 'rows=> array(
            array('id' => 1, 'name'=>'Li'),
            array('id' => 2, 'name'=>'Ming'),
            array('id' => 3, 'name'=>$name),
        );
    }
}


$template->getPagination()->setUrl("/test/?page=@number@");
$template->getPagination()->setNumber(1);
$template->getPagination()->setSize(20);
$template->getPagination()->setTotal(100);