Smarty Assign () how this function is defined
Who can post the code of this function, and how it works
------Solution--------------------
smarty_internal_data.php
/**
* Assigns a Smarty variable
*
* @param array
------Solution--------------------
String $tpl _var the template variable name (s)
* @param mixed $value The value to assign
* @param boolean $nocache If true any output of this variable would be is not cached
* @param boolean $scope The scope the variable would have (local,parent or root)
*/
Public Function assign ($tpl _var, $value = null, $nocache = False)
{
if (Is_array ($tpl _var)) {
foreach ($tpl _var as $_key = $_val) {
if ($_key! = ") {
if (Isset ($this->tpl_vars[$_key])) {
$this->tpl_vars[$_key]->value = $_val;
$this->tpl_vars[$_key]->nocache = $nocache;
} else {
$this->tpl_vars[$_key] = new Smarty_variable ($_val, $nocache);
}
}
}
} else {
if ($tpl _var! = ") {
if (Isset ($this->tpl_vars[$tpl _var])) {
$this->tpl_vars[$tpl _var]->value = $value;
$this->tpl_vars[$tpl _var]->nocache = $nocache;
} else {
$this->tpl_vars[$tpl _var] = new Smarty_variable ($value, $nocache);
}
}
}
}