Skip to content

02.25 Global vars

rafageist edited this page Nov 16, 2026 · 1 revision

2.25 Variables globales

Las variables globales persisten entre instancias de div.

Sintaxis

<?php

div::setGlobal('var-name', $mixed_value);

Ejemplo

index.php

<?php

div::setGlobal('today', date('Y-m-d'));

echo new div('index.tpl', [
    'name' => 'Peter'
]);

echo new div('index.tpl', [
    'name' => 'Jack'
]);

index.tpl

Hello {$name}
Today is: {$today}

Salida

Hello Peter
Today is 2012-08-17

Hello Jack
Today is 2012-08-17

Div

Enlaces

Clone this wiki locally