User Tools

Site Tools


The only thing worse than having an out-of-date web site is to make it painfully obvious to your site visitors that it was not updated since 2007 with your copyright footer.

This code will automatically detect the current year using PHP, and output a proper footer in the format: © 2007-2010 My Company

All you have to do is change $createdyear to the year you created the site (this year if it's a new site) and change $company to your company name (or whoever owns the copyright for the site), and the page's copyright footer will automatically be updated every year.

Original header comment: <pre> the following outputs: © 2009-2010, but 2010 will change automatically every year to 2011, 2012, etc.

 // BUT if the current year is the same as the year you made the page (specified below)
 // it will only show (c) 2009.  Par Robbie.</pre>

Source Code:

<?php echo '<span>Copyright';
$createdyear = 2009; // change that date to be the year you made the site, leave everything else as is
$company = "Your Company Name"; // who is this copyright to?
   echo '&copy;' . $createdyear;
   if (date('Y') > $createdyear) echo "-" . date('Y') . " ";
   echo $company . '</span>';
web_development/dynamic_copyright_footer.txt · Last modified: 2012/01/26 07:48 by import