PHP code example of biurad / templating

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

    

biurad / templating example snippets


use Biurad\UI\Renders\PhpNativeRender;
use Biurad\UI\Helper\SlotsHelper;
use Biurad\UI\FilesystemStorage;
use Biurad\UI\Template;

$filesystemLoader = new FilesystemStorage(__DIR__.'/views');
$templating = new Template($filesystemLoader);

// Before adding a template renderer, you can add a namespace path
// $templating->addNamespace('MyBundle', __DIR__ . '/vendor/company/package/Resources');

// Add a template compiler renderer to Template.
$phpRenderEngine = new PhpNativeRender();
$templating->addRender($phpRenderEngine);

// You can also render an absolute path except for the fact that, it is not cacheable.
echo $templating->render('hello', ['firstname' => 'Divine']);

// hello.phtml or hello.php or hello.html
Hello, <?= $this->escape($firstname)