PHP code example of toropyga / templates

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

    

toropyga / templates example snippets






$TMPL = new FYN\Templates();

$TMPL->setStyle($style_folder);

$TMPL->assign($template_data);
$TMPL->assign(array('page'=>$PAGE));

$TMPL->output($template_file);

$template_file = "hello.html";
$template_data = array("user_name" => "Alex");
$TMPL = new FYN\Templates();
$TMPL->assign($template_data);
$TMPL->output($template_file);
html
<!-- tmplphp: $a = 20; for ($i=1; $i <= $a; $i++) { -->
{$i}<br>
<!-- tmplphp: } -->
html
<!-- tmplphp: $a = 1; $b = 2;  echo sum($a, $b); ##static_begin## function sum($a, $b) { return ($a+$b); } ##static_end## -->