HTML_Template_IT::getGlobalvariables() -- returns an array of all global variables from the variable cache
Description
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.
Return value
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.
Example
Example 44-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());
?> |
|
Note
This function can not be called
statically.