Our network of sites >> talk | feed | free | tech | rock | xbox | homes | learn | game | pods | grab | blog | book | beep | help

Can my website automatically update my copyright notice every year?

Can't wait for a free call tonight or or the free ask-by-email service? Due to time constraints, I can only take questions these days during the times that my show is on the air live. You can call with your question anytime 24/7 at 1-800-39-ONLINE (1-800-396-6546) or 1-888-488-DAVID (1-888-488-3284), even if the show is not on the air. Due to the volume of questions, response is not guaranteed.

However, if you're in a hurry, be sure to take advantage of the premium AskDavidLawrence service when you ask your question below. It's guaranteed!

David answers all questions, including those on acting, advertising, Internet scams, music, podcasting, radio, sound, television, voiceovers, the Web, and on Macintosh, UNIX and Windows computers.

Previously: David Lawrence Unplugged for 1/4/2007: the premium podcast feed of The David Lawrence Show >>
Next: Smart Family goes mobile, Stradivari scandal and Schmidt 2007 >>


Question:

I was working on my website on December 31st, and I was listening to your podcast on a separate browser page. I looked at your site, and noticed that before 11pm, your site said (and I don't know how to make the c-in-circle doohickey - maybe you can help me with that too) Copyright (c) 1987-2006, David Lawrence, Online Today, Inc. and Sotto Voce Film+Works. All rights reserved worldwide.

Then I went to another podcast episode and the date had changed. It was after 11:00pm, and I figured you must have changed them all early.

Then, I heard you on the radio a few days ago saying that you were at one of Ms. VonShloop's burleyq shows - did you do the geekiest of all things and bring a laptop to change them all? I hope not!!!!

If you did somehow automate them, could you tell me how?

Love da show!!!!

Becky, listening on Sirius in Pennsylvania

Answer:

And apparently, you also love exclamation points!!!!!

To set your mind at ease, no, I did not bring my laptop to the club that night. I was, in fact surrounded by gorgeous women, and had no need to attract them further with my mad technology skillz.

Let's quickly answer the question about how to make the circled "c" copyright character. If you try to type it (control-G on Mac or insertion from the character map in Windows) into your HTML code, you'll find that when you try to view that page in a browser, the character won't look anything like what you want.

That's because the circled "c", or ©, isn't part of the basic character set that can be transmitted over the Internet. But...it is a snap to create.

That symbol, and a lot more, are displayed on web pages not by typing them, but by signaling the browser to display them by typing in their HTML entity code. In this case, the code for © is:

©

This string tells the browser, "Hey...when you see this code, just replace it with ©. Thanks." And as a side note, to show you the code rather than the character, I had to use the HTML entity code for the ampersand, otherwise, this page would have simply shown the character.

Keep that in the back of your mind as we solve the mystery of how I updted every page on all of my sites with the new year in my copyright notices without leaving the dance floor.

How that happens is easy, but it depends upon how you've built your website. And just so you know, mine changed at 1am your time, as my servers are in the Central time zone, so you must have come back way past midnight.

Read on... (more ahead)







Let's look at four different ways you can update your site automatically, and one way you can update it very easily by hand.

Before we get to the issue of changing the year, it's important to realize that displaying a copyright notice is A Very Good Idea, but rest easy knowing that our federal government has your back in case you dilly dally a few moments beyond midnight and don't get the notice updated.

Familiarize yourself with the concept of statutory copyright, that provision of the Copyright Act that says you've got copyright protection from the moment you create something, whether you've gotten around to placing a copyright notice or not.

Do put a copyright notice on stuff, but don't stress about making it the very first thing you do.

Now, here are a few different code strings for making a copyright notice that is maintenance free - and each of them will change your page automatically at the beginning of each new year, with the very first visitor to visit your site.

If you have Movable Type, as I do for this blog, you have some special Movable Type date tags you can use to create the year part of the notice. Everytime the page is loaded, Movable Type asked the server to give it the current time and date.

You can use this to your advantage. Here's what my HTML code looks like for my copyright notice:

<p>Copyright &copy; <$MTDate format="%Y"$>, Online Today, Inc.</p>

Just copy and paste that code above, changing my company's name to whoever or whatever controls your copyright.

If you have a site that is based in PHP, there is a similar set of code:

<p>Copyright &copy; <?php echo date("Y") ?>, Online Today, Inc.</p>

If would like to use Javascript because your website is not a blog system or PHP-based, it's a bit more complicated. Here's the code for that:


<p>Copyright &copy; <script language="javascript" type="text/javascript">
var today = new Date()
var year = today.getYear()
if (year < 1900)
{
year = year + 1900;
}
document.write(year)
</script>, Online Today, Inc.</p>

Be aware that some people turn off Javascript in their browser, so they may just see your code.

And finally, this problem is a great example of why server-side includes are so useful. You can update all of your pages at the same time, without a blog, without PHP, without Javascript, simply by using a server-side include and updating that one item at midnight on December 31st. It's manual, but it works. It requires that your ISP set your web server up to recognize includes, so contact them and tell them what you're doing. They'll help you out.

What is a server-side include? It's a text file, just like an HTML file, that includes code that gets blended into other pages on your site. Like a copyright notice, or a menu bar.

My server-side include files' have special file names, like 'footer.htmlf' and 'menu.htmlf'. Notice the "f"? That stands for 'fragment' to me - a fragment of code.

On all of my pages, at the very bottom, if you were able to see the raw code (you can't by viewing source, because the code is assembled as one long finished product before your browser displays it), you'd see one of these:

<!--#include virtual="copyright.htmlf"-->

That's called an include statement. Use it wherever you want the copyright notice to appear on pages of your website.

And the copyright.htmlf file it mentions? That consists of nothing more than that copyright code we built above. This lets me include the code from that file in other files, on a consistent basis. And if I ever change the name of my company, or I want to add "All Rights Reserved, Mister!", I only have to change the code in that htmlf file, not the code on every page.

What happens is cool: as visitors come to visit my pages, wherever there is an include statement like the one above, whatever code is in the file it mentions gets put in place of the include statement. Once all that's complete, then the server gives the code to the visitor's browser for display.

Pretty neat, huh?

And it works even for manually built sites. So, you might have to change the year, but in one file. As your site grows, that's going to save you a lot of time.

Thanks for asking!



Comments? Questions of your own?




Was this helpful? Buy David a Starbucks® Mocha via PayPal!

David loves his Starbucks® mocha. Skim, no whip, please. To easily and painlessly send David a selection from Starbucks® and paying via PayPal, just click on the button below your choice:

Listeners who have bought David a Starbucks® Mocha:

Chuck Craig Becky Bob Chris Dana Dean Gary Heidi Jen Jim Faucett (link?) Kevin Leo Lili Linda Michael Randy Ray Scott Sophie Sophie (II) Warren (link?)

Digg This! article or tag it at del.icio.us


Link to this article from your own website

Just copy this HTML code block. Then, paste it into your own code:





Up To The Minute Bargains



Want an e-Mini-Mall for your site?


If you need help

You can always call in to the show at the number listed above, or send David an email using the link above.


To repeat: You can always call in to the show at the number listed above, or send David email using the link above.