1: <?php
2:
3: /**
4: * Smarty Method AssignByRef
5: *
6: * Smarty::assignByRef() method
7: *
8: * @package Smarty
9: * @subpackage PluginsInternal
10: * @author Uwe Tews
11: */
12: class Smarty_Internal_Method_AssignByRef
13: {
14: /**
15: * assigns values to template variables by reference
16: *
17: * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
18: * @param string $tpl_var the template variable name
19: * @param $value
20: * @param boolean $nocache if true any output of this variable will
21: * be not cached
22: *
23: * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
24: */
25: public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache)
26: {
27: if ($tpl_var !== '') {
28: $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache);
29: $data->tpl_vars[ $tpl_var ]->value = &$value;
30: if ($data->_isTplObj() && $data->scope) {
31: $data->ext->_updateScope->_updateScope($data, $tpl_var);
32: }
33: }
34: return $data;
35: }
36: }
37: