setGlobalVariable() – Sets a global variable value.


require_once 'HTML/Template/Sigma.php';

void HTML_Template_Sigma::setGlobalVariable ( mixed $variable , string $value = '' )


Sets a global variable value. Global variables are "special": they do not get cleared after substitution and do not make blocks not empty if substituted.


mixed $variable

variable name or array ('varname'=>'value')

string $value

variable value if $variable is not an array


throws no exceptions thrown


This function can not be called statically.

Sets the name of the current block. (Previous) Sets the option for the template class (Next)
Last updated: Mon, 25 Sep 2017 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

Note by:
This is a really good function to know about as it solves a common conundrum.

Oftentimes in a list form you'll get a situation where you have something like (All follows in pseudocode/pseudohtml)

[-- BEGIN block --]
{item1} {item2} {currency}{price}
[-- END block --]

Now, you'd itterate that block by doing something like
foreach ($items as $item) {

Now if you do a setvariable to get the currency in the currency/total, it'll also mark a new block and you end up with an empty block line.

HOWEVER if you use the setGlobalVariable, it wont unempty the block, thus leaving the table as it should