From a688201f10d1719c6d46a75fe12bc9a98fec76cf Mon Sep 17 00:00:00 2001 From: messju Date: Mon, 24 Nov 2003 15:37:03 +0000 Subject: [PATCH] move function.assign.php to compiler.assign.php --- NEWS | 1 + libs/plugins/compiler.assign.php | 33 +++++++++++++++++++++++++++++ libs/plugins/function.assign.php | 36 -------------------------------- 3 files changed, 34 insertions(+), 36 deletions(-) create mode 100644 libs/plugins/compiler.assign.php delete mode 100644 libs/plugins/function.assign.php diff --git a/NEWS b/NEWS index 55f23d18..ae5c9c9d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - move function.assign.php to compiler.assign.php (messju) - add property $tpl_error_reporting (messju) - remove property $undefined. "null" is used literally instead (messju) diff --git a/libs/plugins/compiler.assign.php b/libs/plugins/compiler.assign.php new file mode 100644 index 00000000..506083c5 --- /dev/null +++ b/libs/plugins/compiler.assign.php @@ -0,0 +1,33 @@ + + * Name: assign
+ * Purpose: assign a value to a template variable + * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} + * (Smarty online manual) + * @param string containing var-attribute and value-attribute + * @param Smarty_Compiler + */ +function smarty_compiler_assign($tag_attrs, &$compiler) +{ + $_params = $compiler->_parse_attrs($tag_attrs); + + if (!isset($_params['var'])) { + $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); + return; + } + + if (!isset($_params['value'])) { + $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); + return; + } + + return "\$this->assign({$_params['var']}, {$_params['value']});"; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.assign.php b/libs/plugins/function.assign.php deleted file mode 100644 index bcc5a7c5..00000000 --- a/libs/plugins/function.assign.php +++ /dev/null @@ -1,36 +0,0 @@ - - * Name: assign
- * Purpose: assign a value to a template variable - * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} - * (Smarty online manual) - * @param array Format: array('var' => variable name, 'value' => value to assign) - * @param Smarty - */ -function smarty_function_assign($params, &$smarty) -{ - if (empty($params['var'])) { - $smarty->trigger_error("assign: missing 'var' parameter"); - return; - } - - if (!in_array('value', array_keys($params))) { - $smarty->trigger_error("assign: missing 'value' parameter"); - return; - } - - $smarty->assign($params['var'], $params['value']); -} - -/* vim: set expandtab: */ - -?>