PHP code example of blue-tomato / template-engine-smarty

1. Go to this page and download the library: Download blue-tomato/template-engine-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/ */

    

blue-tomato / template-engine-smarty example snippets


function foo_function($params, $smarty) {
  return 'bar';
};

wire()->addHookAfter('TemplateEngineSmarty::initSmarty', function (HookEvent $event) {
    /** @var \Smarty $smarty */
    $smarty = $event->arguments('smarty');

    $smarty->registerPlugin("function", "foo", "foo_function");
});

// ... and then use it anywhere in a Smarty template:

{foo}