Keep your copyright dates up-to-date

25th Apr 2006

I always consider it a telltale sign that a website isn't cared for much when the copyright dates are out-of-date. If you've ever faced this situation yourself, you may have come up with a simple workaround already. If not, then here's a little PHP script that should banish out-of-date copyright dates for good.

Displaying a copyright notice on your website isn't obligatory in the UK, however, it does have one very good use wherever you happen to reside: it lets your site visitors know that the content belongs to you.

A copyright notice takes the following format: copyright symbol, followed by the name of the copyright owner and ends with the from and to dates of the copyright.

Here's a useful little script you can add into your web pages. All you need to do is include this following code into the header of your documents and then echo out the variable $copyright wherever you need to display your copyright notice... and it will always be up-to-date!

<?php

//the year today
$thisyear = date('Y');

//the year your copyright was established
$established = "2002";

//name of copyright owner
$copyright_owner = "Blair Millen";

//display correct copyright notice
if($thisyear==$established) $copyright = "&#xA9; $copyright_owner $established";
else $copyright = "&#xA9; $copyright_owner $established&ndash;$thisyear";

?>