Automatic Copyright Notice Year Update

| 4 Comments

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.

4 Comments

<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.

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

cheers!

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 :)

Leave a comment

About this Entry

This page contains a single entry by Elise published on January 8, 2007 10:11 AM.

Dynamic Comment Previewing was the previous entry in this blog.

Helping MT and Images Get Along Nicely is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.