PHP code example of denis909 / php-view
1. Go to this page and download the library: Download denis909/php-view 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/ */
denis909 / php-view example snippets
use denis909\view\View;
$view = new View(__DIR__ . '/templates'); // create renderer instance
$content = $view->render('test', ['param1' => 'value 1']); // render template to string
echo $content;
<h1>top</h1>
<?= $this->escape($param1);
$content = $view->renderFile(__DIR__ . '/templates2/test.php', ['param1' => 'value 1']);
echo $content;