Added Canvas 1.1.0, originally not under SCM so no historical development records...
[canvas.git] / library / smarty / plugins / compiler.assign.php
blob25970f1bfae0213fb3bfffa4a1fc2ca9ce82edb4
1 <?php
2 /**
3 * Smarty plugin
4 * @package Smarty
5 * @subpackage plugins
6 */
8 /**
9 * Smarty {assign} compiler function plugin
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 * @author Monte Ohrt <monte at ohrt dot com> (initial author)
17 * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
18 * @param string containing var-attribute and value-attribute
19 * @param Smarty_Compiler
21 function smarty_compiler_assign($tag_attrs, &$compiler)
23 $_params = $compiler->_parse_attrs($tag_attrs);
25 if (!isset($_params['var'])) {
26 $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
27 return;
30 if (!isset($_params['value'])) {
31 $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
32 return;
35 return "\$this->assign({$_params['var']}, {$_params['value']});";
38 /* vim: set expandtab: */