jump to navigation

Eternal Copyright May 25, 2006

Posted by Lucanos in : Uncategorized, programming, php, snippet , 1 comment so far

Now, for the most part, I don’t like copyright. I far prefer the far more community-minded and development-driving concepts of copyleft, GPL and creative commons. The only times I use copyright is when it comes to my photography (especially for commercial uses) and major software work (like a contract or a large project).

Copyright, from my understanding, is established by simply putting the copyright symbol “©” (”Alt-0169″ in most word processors and “&0169;” in HTML) the word “Copyright”, your name or business name, and then the year. The year is meant to be the year the item/photo/whatever was first created, and then, if it was updated after that time, it’s meant to have a dash, then the most recent year when a change was made.

This is all well and good when dealing with something static. Like a plain vanilla HTML page with static information, or a photo, or something that doesn’t change. But what about dynamic pages? What about pages like those served using a Content Management System, or your own PHP & SQL concoction? With those kinds of items, the content is constantly changing (or has the potential to do so), so the year section in the copyright notice also needs to be chaning constantly.

How to do it…

Easy, provided you have the ability to write PHP code into your page templates. In WordPress that shouldn’t be too hard. I know that in TextPattern all you do is put the PHP betweeen the … tags. The rest? Do a little research, and if you still have problems, let me know…

The code?

$startYear = 2006; // The start year
$currYear = date(”Y”);
echo $startYear.( $currYear > $startYear ? ” - “.$currYear : “” );

All you do is put the “&0169; Copyright John Smith ” in front of that baby and Bob’s your aunty’s live-in-lover.

If you have any problems with this snippet, or any suggestions, please feel free to comment here and I’ll see what I can do to assist.

UPDATE
I have created a TextPattern Plugin to automate the insertion of these notices, as per above. The plugin, when given a start year, generates the dynamic year range (e.g. “2000-2006″) and includes the Copyright Symbol.
Download it here.