PHP code example of hitsi / mezzio-smarty-renderer

1. Go to this page and download the library: Download hitsi/mezzio-smarty-renderer 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/ */

    

hitsi / mezzio-smarty-renderer example snippets


'templates' => [
    'extension' => 'file extension used by templates; defaults to tpl',
    'paths' => [
        // namespace / path pairs
    ],
],
'smarty' => [
    'template_dir' => 'default/main templates',
    'cache_dir' => 'path to cached templates',
    'compile_dir' => 'path to compiled templates',
    'config_dir' => 'path to config',
    'assets_url' => 'base URL for assets',
    'assets_version' => 'base version for assets',
    'plugins' => [
        // your own plugins
    ],
    'globals' => [
        // Global variables passed to smarty templates
    ],
    'compile_check' => true, // https://www.smarty.net/docs/en/variable.compile.check.tpl
    'force_compile' => false, // https://www.smarty.net/docs/en/variable.force.compile.tpl
    'caching' => false, // https://www.smarty.net/docs/en/variable.caching.tpl
    'debugging' => false, // https://www.smarty.net/docs/en/variable.debugging.tpl
],

'templates' => [
    'extension' => 'file extension used by templates; defaults to tpl',
    'paths' => [
        'app' => __DIR__.'/../templates/app',
        'admin' => __DIR__.'/../templates/admin',
        'layout' => __DIR__.'/../templates/layout',
        ...
    ],
],
'smarty' => [
    'template_dir' => __DIR__.'/../templates',
    ...
]

$this->template->render('app::index', $params);

$this->template->render('app/index.tpl', $params);

'factories' => [
    Path\To\YourPlugin::class => Path\To\YourPluginFactory::class,
],
'smarty' => [
    'plugins' => [
        'myplugin' => Path\To\YourPlugin::class,
    ],
],