PHP code example of sevenphp / savantphp
1. Go to this page and download the library: Download sevenphp/savantphp 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/ */
sevenphp / savantphp example snippets
$ composer
/* file.php */
use SavantPHP\SavantPHP;
$yourConfigBag = [
\SavantPHP\SavantPHP::TPL_PATH_LIST => ['/path/to/yourViews/', '/path/to/someOtherFolder/anotherViewFolder/'], //as you can see, set all possible places where your template will reside
\SavantPHP\SavantPHP::CONTAINER => $yourContainer //can be anything, e.g a pimple container
];
$tpl = new SavantPHP($yourConfigBag);
$tpl->mynameis = 'Wasseem';
$tpl->setTemplate('file.tpl.php');
$tpl->display(); //or $response = $tpl->getOutput();
/* file.tpl.php | See how other **master templates** are also f(isset($this->mynameis)) echo $this->escape($this->mynameis)