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