setGlobalVariable() – グローバル変数の値を設定する


require_once 'HTML/Template/Sigma.php';

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


グローバル変数の値を設定します。グローバル変数は "特別" なもので、 置換が行われた後もクリアされません。また、置換後もブロックを空にしません。


mixed $variable

変数名あるいは ('変数名'=>'値') 形式の配列。

string $value

$variable が配列でない場合の、変数の値。




HTML_Template_Sigma::setVariable() も参照ください。


This function can not be called statically.

現在のブロックの名前を設定する (Previous) テンプレートクラスのオプションを設定する (Next)
Last updated: Mon, 05 Oct 2015 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

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