Хранилища Subversion ant

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
* Smarty method Register_Block
5
*
6
* Registers a PHP function as Smarty block function plugin
7
*
8
* @package Smarty
9
* @subpackage SmartyMethod
10
* @author Uwe Tews
11
*/
12
 
13
/**
14
* Register a PHP function as Smarty block function plugin
15
*/
16
 
17
/**
18
* Registers block function to be used in templates
19
*
20
* @param string $block_tag name of template block
21
* @param string $block_impl PHP function to register
22
* @param boolean $cacheable if true (default) this fuction is cachable
23
*/
24
function register_block($smarty, $block_tag, $block_impl, $cacheable = true, $cache_attr = array())
25
{
26
    if (isset($smarty->registered_plugins[$block_tag])) {
27
        throw new Exception("Plugin tag \"{$block_tag}\" already registered");
28
    } elseif (!is_callable($block_impl)) {
29
        throw new Exception("Plugin \"{$block_tag}\" not callable");
30
    } else {
31
        $smarty->registered_plugins[$block_tag] =
32
        array('block', $block_impl, $cacheable, $cache_attr);
33
    }
34
}
35
 
36
?>