Today I needed code that would dynamically set the $site_name variable, changing the site name of a drupal site temporarily on certain nodes.
It took a while to find, but here is a working solution. Somehow it seems a bit ‘wrong’, but it works nonetheless.
$GLOBALS[‘conf’][‘site_name’] = ‘new site name’;
Thank you to: http://drupal.org/node/253447.