register_block

void register_block (string name, string impl)

Use this to dynamically register block functions plugins. Pass in the block function name, followed by the PHP function name that implements it.

Пример 13-21. register_block

<?php

/* PHP */
$smarty -> register_block ( "translate" , "do_translation" );

function
do_translation ( $params , $content , & $smarty ) {
    if (
$content ) {
        
$lang = $params [ 'lang' ];
        
// do some translation with $content
        
echo $translation ;
    }
}
?>

{* template *}
{translate lang="br"}
   Hello, world!
{/translate}