When comparing the number of search results for "Copyright 2011" and all the years down to "Copyright 2000" only 23.56 % are updated with "Copyright 2011".
That means that literally 76.44 % are staying unprofessional - and in worst case it could cost them money because the copyright isn't up to date.
That means that around 19,535,770,800 websites are NOT updated with Copyright 2011!
There is a solution for this. And it is very simple - and it only takes 5 minutes to do. In this article I'll explain exactly how you can do it.
And the best part of it is that it happens automatically in real-time, so you could literally have hundreds of sites, and they all used the same code - in which case it would save you hours.
Now one thing to note about this is, that it update it according to the servers time settings, so while it might have been new year in one place - in another - it might not have been new year.
So in fact it would show a totally wrong year! Now this isn't so bad since the same thing would have happened anyway since you only update your site once, and it is all over the world.
I suppose you could use a geolocation service, or get the time from the local computer, or something, but that is way out of the scope for this article.
If your files names are something.html (such as index.html), or something.htm (such as index.htm), you need to rename them to something.php (such as index.php).
This should have no effect on your pages.
Now go to your HTML code, where you have the copyright year. If you use a WYSIWYG editor (What You See Is What You Get editor - visual editor), make sure you are in code view.
The copyright in HTML should normally look something like this (though it could vary depending on a number of things).
Normal copyright HTML code
Now what we do is to have the last year updated automatically. That actually very easy to automate. It could be done like this:
Copyright with PHP code that update the copyright year automatically
- <p>Copyright Â© 2010-<?php echo date("Y"); ?></p>
Going through the PHP code
As you can see - we have put a few things up there. The first thing - php - is the start tag. There are also a short version of this -
Then we use echo to write it out to the screen. We could also have used print. Print is - like echo - used to write to the screen. There are a few differences, but they are not big. Generally, most PHP developers mainly use echo.
Then we have date. Unlike echo and print, date is actually a function and should be written as such - date(). On the website linked to date() - you can also find the things you can write in the parameter.
I could for example write a date such as 28-12-2011 with PHP like this (assuming it was todays date):
- <?php echo date("d-m-Y"); ?>
Now we can also do some tricks, so we can get another date echoed, but it is out of the scope of this article, so we'll let another article explain that.
Another way we can make sure that we don't end up with some ugly-looking copyright year - before the first year is gone - we can use the code below:
Better PHP copyright year
As you can see you need to edit the year in $startYear, but apart from that - you can use that code posted there.
If you just have another 2 minutes - I would appreciate if you would leave a comment below.
Thanks for reading my article.