Smarty Assign () How is this function defined?

Source: Internet
Author: User
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);
}
}
}
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.