HTML_Template_IT::getGlobalvariables() -- returns an array of all global variables from the variable cache
Описание
Gets an array of all global variables in the variable cache. Only variables that are filled using HTML_Template_IT::setVariable() are returned. The returned has two values. The first values holds an array with the names of the global variables, the second value holds an array with all the values.
Возвращаемое значение
array -
An array. The key 0 holds an array with the names of all filled variables, the key 1 holds an array with names of the according values.
Пример
Пример 42-1. Script <?php
require_once("HTML/Template/IT.php");
$template = <<<EOF
<!-- BEGIN a -->
Hello {username}
<!-- END a -->
Welcome to {page},
You are visitor number {visitorcount}.
EOF;
$tpl = new HTML_Template_IT('.');
$tpl->setTemplate($template);
// set the {page} variable. It will be returned by getGlobalvariables then.
$tpl->setVariable("page", "http://example.com");
$tpl->setVariable("username", "foo");
// getGlobalvariables won't return {username} as it is not a global variable
// It won't return {visitorcount} as it is not set
print_r($tpl->getGlobalvariables());
?> |
|
Заметка
Эта функция не должна вызываться статически.
HIVE: All information for read only. Please respect copyright! |
|