How to call site name in PHP block? I have a block in my footer that I currently use to display a copyright message using PHP, like so:

Copyright © &lt;?php echo date("Y"); ?&gt;


I'd like to add the site name to that code snippet, dynamically instead of typing the name. How can I do so?

So the end result would be:

Copyright © &lt;?php echo date("Y"); ?&gt; [[[php code to display site name goes here]]]


Thanks!
You can use variable_get() to get the site name, but you shouldn't use it directly in the template file or you could break caching.

Instead, define a preprocess function in your theme's template.php file:

function MYTHEME_preprocess_page(&amp;$vars) {
  $vars['site_name'] = variable_get('site_name', 'Default');
}


Then you can use this in the template file:

Copyright © &lt;?php echo date("Y"); ?&gt; &lt;?php echo $site_name; ?&gt;


Before doing that, though, check whether you already have $site_name available in page.tpl.php. Some themes add it for you, some don't.