PHP code example of antonienko / php-template-previewer
1. Go to this page and download the library: Download antonienko/php-template-previewer 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/ */
antonienko / php-template-previewer example snippets
namespace app\controllers;
use antonienko\PhpTempPrev\FrameworkStrategies\PhalconStrategy;
use antonienko\PhpTempPrev\FileStrategies\IniFileStrategy;
use antonienko\PhpTempPrev\Previewer;
class DesignTestController extends ControllerBase
{
public function viewAction($controller, $view)
{
$view_variables_file = APP_PATH . 'templateHelpers/' . $controller . '/' . $view . '.ini';
$layout_variables_file = APP_PATH . 'templateHelpers/general.ini';
$previewer = new Previewer(new PhalconStrategy($this->view));
$previewer->render("$controller/$view", new IniFileStrategy([$layout_variables_file, $view_variables_file]));
}
}