Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created August 15, 2012 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litzinger/3360372 to your computer and use it in GitHub Desktop.
Save litzinger/3360372 to your computer and use it in GitHub Desktop.
server name as global variable
/*
Add this to your config.php file
*/
$default_global_vars = array(
'global:domain_name' => $_SERVER['SERVER_NAME']
);
// Make this global, then add our default_global_vars to the config variables here
global $assign_to_config;
if(!isset($assign_to_config['global_vars'])) $assign_to_config['global_vars'] = array();
$assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars);
/*
Use in your template as {global:domain_name}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment