http://b.co.ke

The problem:
Drupal’s default ‘Footer message’ area (to which you can add content via the admin section – Administer > Site configuration > Site information) will not parse PHP.

If, for example, you add a copyright message to your footer message area such as “© Copyright 2009” it’ll be fine until the New Year begins and you have to go in and manually change it to “© Copyright 2010”. So, instead, it would be great if you could handle the date dynamically using the following PHP code (see http://php.net/date for further PHP date details):

© Copyright <?php echo date('Y'); ?>
However, try adding that to the default ‘Footer message’ area and it will simply output the entirety of the code as text, ignoring the PHP tags.

© Copyright <?php echo date(‘Y’); ?>

So, what to do?

Solution 1:
Create a block (admin/build/block/add) containing the code, set its input format to PHP, and then place that block in the footer region via the main blocks settings page (admin/build/block). Crazy simple.


Leave a Reply

Your email address will not be published. Required fields are marked *