PHP code example of phalcon-framwork / view-engine

1. Go to this page and download the library: Download phalcon-framwork/view-engine 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/ */

    

phalcon-framwork / view-engine example snippets

 php
use PhalconViewEngine\Smarty as ViewEngineSmarty;

// 视图配置
/* 'engines' => [ 
        '.volt' => 'viewEngineVolt',
        '.phtml' => 'viewEnginePhp',
        '.html' => 'viewEngineSmarty'
    ] */

$di->setShared('viewEngineSmarty', function (View $view, DI $di) {
	// 获取配置
    $smartyConfig = $this->getConfig()->services->view_engine_smarty->toArray();
    $viewEngineSmarty = new ViewEngineSmarty($view, $di);
    // 设置配置
    $viewEngineSmarty->setOptions($smartyConfig);
    return $viewEngineSmarty;
});