1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 03:34:04 +02:00

Merge remote-tracking branch 'cyberalien/feature/append_var' into develop

* cyberalien/feature/append_var:
  [feature/append_var] Adding test case
  [feature/append_var] Adding append_var template class function
This commit is contained in:
Oleg Pudeyev
2012-03-07 18:20:49 -05:00
3 changed files with 70 additions and 2 deletions

View File

@@ -53,7 +53,9 @@ class phpbb_template_context
}
/**
* Assign a single variable to a single key
* Assign a single scalar value to a single key.
*
* Value can be a string, an integer or a boolean.
*
* @param string $varname Variable name
* @param string $varval Value to assign to variable
@@ -65,6 +67,21 @@ class phpbb_template_context
return true;
}
/**
* Append text to the string value stored in a key.
*
* Text is appended using the string concatenation operator (.).
*
* @param string $varname Variable name
* @param string $varval Value to append to variable
*/
public function append_var($varname, $varval)
{
$this->rootref[$varname] = (isset($this->rootref[$varname]) ? $this->rootref[$varname] : '') . $varval;
return true;
}
/**
* Returns a reference to template data array.
*

View File

@@ -378,7 +378,9 @@ class phpbb_template
}
/**
* Assign a single variable to a single key
* Assign a single scalar value to a single key.
*
* Value can be a string, an integer or a boolean.
*
* @param string $varname Variable name
* @param string $varval Value to assign to variable
@@ -388,6 +390,19 @@ class phpbb_template
$this->context->assign_var($varname, $varval);
}
/**
* Append text to the string value stored in a key.
*
* Text is appended using the string concatenation operator (.).
*
* @param string $varname Variable name
* @param string $varval Value to append to variable
*/
public function append_var($varname, $varval)
{
$this->context->append_var($varname, $varval);
}
// Docstring is copied from phpbb_template_context method with the same name.
/**
* Assign key variable pairs from an array to a specified block