Page MenuHomeCode

smarty_method_get_global.php
No OneTemporary

smarty_method_get_global.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 Smarty_Method_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;
}
}
?>

File Metadata

Mime Type
text/x-php
Expires
Sat, Feb 22, 15:27 (7 h, 47 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25877
Default Alt Text
smarty_method_get_global.php (793 B)

Event Timeline