Files
smarty/libs/sysplugins/method.get_global.php
Uwe.Tews d2d8c8925b - removed all internal calls of Smarty::instance()
- fixed code in double quoted strings
2009-08-08 17:28:23 +00:00

38 lines
778 B
PHP

<?php
/**
* Smarty method Get_Global
*
* Returns a single or all global variables
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Returns a single or all global variables
*
* @param object $smarty
* @param string $varname variable name or null
* @return string variable value or or array of variables
*/
function get_global($smarty, $varname = null)
{
if (isset($varname)) {
if (isset($smarty->global_tpl_vars[$varname])) {
return $smarty->global_tpl_vars[$varname]->value;
} else {
return '';
}
} else {
$_result = array();
foreach ($smarty->global_tpl_vars AS $key => $var) {
$_result[$key] = $var->value;
}
return $_result;
}
}
?>