51ff3226 |
1 | <?php |
2 | /** |
3 | * Smarty plugin |
4 | * @package Smarty |
5 | * @subpackage plugins |
6 | */ |
7 | |
8 | /** |
9 | * Smarty {assign} compiler function plugin |
10 | * |
11 | * Type: compiler function<br> |
12 | * Name: assign<br> |
13 | * Purpose: assign a value to a template variable |
14 | * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} |
15 | * (Smarty online manual) |
16 | * @param string containing var-attribute and value-attribute |
17 | * @param Smarty_Compiler |
18 | */ |
19 | function smarty_compiler_assign($tag_attrs, &$compiler) |
20 | { |
21 | $_params = $compiler->_parse_attrs($tag_attrs); |
22 | |
23 | if (!isset($_params['var'])) { |
24 | $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); |
25 | return; |
26 | } |
27 | |
28 | if (!isset($_params['value'])) { |
29 | $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); |
30 | return; |
31 | } |
32 | |
33 | return "\$this->assign({$_params['var']}, {$_params['value']});"; |
34 | } |
35 | |
36 | /* vim: set expandtab: */ |
37 | |
38 | ?> |