PHP code example of node-link / cakephp-smarty

1. Go to this page and download the library: Download node-link/cakephp-smarty 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/ */

    

node-link / cakephp-smarty example snippets



use Cake\Core\Plugin;

Plugin::load('NodeLink/Smarty');


namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;

class AppController extends Controller
{
    public function beforeRender(Event $event)
    {
        $this->viewBuilder()->setClassName('NodeLink/Smarty.App');

        // Prior to CakePHP 3.4.0
        $this->viewBuilder()->className('NodeLink/Smarty.App');
    }
}


return [
    // Add the following
    'Smarty' => [
        'debugging' => true,                            // Default: Configure::read('debug')
        'auto_literal' => true,                         // Default: true
        'escape_html' => true,                          // Default: false
        'left_delimiter' => '<!--{',                    // Default: '{'
        'right_delimiter' => '}-->',                    // Default: '}'
        'error_reporting' => E_ALL & ~E_NOTICE,         // Default: null
        'force_compile' => true,                        // Default: Configure::read('debug')
        'caching' => Smarty::CACHING_LIFETIME_CURRENT,  // Default: false
        'cache_lifetime' => 86400,                      // Default: 3600
        'compile_check' => true,                        // Default: true
        'compile_dir' => null,                          // Default: CACHE . 'views'
        'cache_dir' => null,                            // Default: CACHE . 'smarty'
        'config_dir' => null,                           // Default: CONFIG . 'smarty'
        'plugins_dir' => null,                          // Default: CONFIG . 'smarty' . DS . 'plugins'
        'template_dir' => null,                         // Default: APP . 'Template'
        'use_sub_dirs' => false,                        // Default: false
    ],
];