PHP code example of romanzaycev / tooolooop

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

    

romanzaycev / tooolooop example snippets


 declare(strict_types = 1);

;

$engine = new Engine(__DIR__ . '/views');

$template = $engine->make('page');
$template->assign(['text' => 'Lorem ipsum']);

echo $template->render();



use Romanzaycev\Tooolooop\Engine;
use Psr\Container\ContainerInterface;

/** @var ContainerInterface $container */
$container = ...; // Initialize PSR-11 container
                  // and define implementation of Romanzaycev\Tooolooop\Scope\ScopeInterface
$engine = new Engine(__DIR__ . '/views');
$engine->setContainer($container);
$template = $engine->make('page'); // <-- Scope in this template will be obtained from container



use Romanzaycev\Tooolooop\Engine;
use Romanzaycev\Tooolooop\Scope\Scope;
use Romanzaycev\Tooolooop\Scope\ScopeInterface;

class UserSpecificScope extends Scope implements ScopeInterface {
    // Implement your additions, ex. widget system :-)
}

$engine = new Engine(__DIR__ . '/views');
$engine->setScopeClass(UserSpecificScope::class);
html
 $this->extend('layout')