How To

Copyright block: a footer with php code in drupal


Drupal has a nice feature to input a site wide footer message from the administration panel, it can be found at Administer>>Site configuration>>Site informationn  scroll down to Footer message:.

The only thing with this is that it is text only, and what you typically want is to be able to add some dynamic content in there.

One of the first thing you would want to do is to add a copyright notice to your site. Now, there is a module for nearly everything, and so there is this gem appropriately called  'Copyright'  which can set the copyright for the entire site and for individual  content pages.

There is a simpler way that, although manual, will help keep your install "light".

What I do is to just create a block, set the input format to "PHP code" and enter the following code:

<p>&copy; <?php print(date(Y)) ?> <a href="/"><?php print(variable_get('site_name', '')) ?></a><br />
All rights reserved

After that you can further customize when and where it will appear, if you need special formatting you can add css classes to it and enhance it's display as needed.

Syndicate content