You are here

function Smarty::assign in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/smarty/Smarty.class.php \Smarty::assign()

assigns values to template variables

Parameters

array|string $tpl_var the template variable name(s):

mixed $value the value to assign:

1 call to Smarty::assign()
Smarty::Smarty in includes/moodle/lib/smarty/Smarty.class.php
The class constructor.

File

includes/moodle/lib/smarty/Smarty.class.php, line 579

Class

Smarty
@package Smarty

Code

function assign($tpl_var, $value = null) {
  if (is_array($tpl_var)) {
    foreach ($tpl_var as $key => $val) {
      if ($key != '') {
        $this->_tpl_vars[$key] = $val;
      }
    }
  }
  else {
    if ($tpl_var != '') {
      $this->_tpl_vars[$tpl_var] = $value;
    }
  }
}