« Dynamic Comment Previewing | Main | Helping MT and Images Get Along Nicely »

Automatic Copyright Notice Year Update

Every year come January we have to start signing checks with a new date. One little site detail that often gets overlooked is the date on the copyright notice (if you have a copyright notice) for your blog. If your site is PHP friendly, you can replace the copyright date with a little php script that automatically puts in the correct year.

Replacing the date with <?php echo date('Y'); ?> will do the trick. For example, the copyright code for LMT is:

Copyright &copy; 2004-<?php echo date('Y'); ?>

There's probably a way to do this just with using MT tags. Anyone know how? If so, please let us know in the comments and I'll add it to this post.

Comments (4)

<MTDate format="%Y"> should work :)

Yes indeed, MTDate should work fine.

Just make sure you rebuild every page that uses it, or put it into a dynamically generated template, so it is built with PHP on demand, though caching may affect the date for a brief period.

If you use a footer and include that dynamically on your pages (via PHP or SSI), then this might be as simple as a single rebuild. If you have a footer on every page, it might mean rebuilding everything.

frank:

Just to say hi & thanks for the new tip. Hope that with this new year you'll post more often too!

cheers!

Stefaan:

Easiest? Use SSI includes, make your copyright statement a file fragment that can be pulled in with a simple <!--#include virtual="/path/to/copyright" -->

End of story :)

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)