You Are Here: Home » How-To » Programming

New Year – Change Copyright Year In Your Website Footer In One Go!

By Debjit on January 3rd, 2014 
Advertisement

So its that time of the New Year when you have to change the dates in the footer next to the copyright symbol on your website. It can be cumbersome task if you have many pages in your website and there is no common footer file for these pages - which means you will have to change the copy-right year on each and every file - sounds so boring.

Change copyright date-year in footer

Change copyright date-year in footer

Footers are one of the most important part of a Website which webmasters generally ignore. Here is a short writeup on how you can use the Footer to get some additional traffic mojo and make it more useful to your visitors.

So here is a quick tip that will have you from this headache in the future - forever. Yes, once you implement this you will never have to look back and worry during the new year to change the copy-right year, it will happen automatically. The change is pretty simple and we will show the trick for some common web platforms.

If you have your own web-hosting where you host your site then it will for sure run one of the following web scripting languages:

  • PHP
  • ASP.NET (dot Net)
  • Django
  • Node.js - Express

This can be an endless list. The idea is to use the date function present in these languages to print the year instead of doing it manually like you might have been doing till now.

PHP

If your website is built using WordPress or Drupal or Codeigniter or Zend or Laravel or any PHP based web framework then this technique will work. Even if you website uses a bit of PHP, this technique will just work fine. Open all your files or the common footer file and wherever you have the year hard coded, just replace it with this:

<?php echo date("Y"); ?>

Save your files, and reload your website you will see that the Year has now changed to the current year. This is an one-time change and you need to change the copyright year again ever in the future - you are all set forever in this matter!

ASP.NET (DotNet)

If your website is built using Classic ASP or the ASP.NET framework then you can use this cone snippet below. Like we said above, you will have to open all your files or the common footer file and wherever you have the year hard coded, just replace it with this:

Copyright @@ @DateTime.Now.Year

Now you can save your files, and reload your website to see the magic. Again, this is something you will never have to bother about.

Django - show year in footer

In this python based DJango web framework, in order to print the date - Year in the copyright, all you have to do is just replace your manually coded Year in the code footer files to the following and you will be all set:

{%now "Y"%}

Node.Js - Expressjs - Print date / year

Last but not the least, we had to write about this as Node.js is currently taking over the web by a storm. In order to change the footer date year in your Node.js or Express powered website, you have to use the following code snippet:

new Date().toISOString().substr(0,4)

And this is all it, if you feel we have missed a specific platform that your website runs on then you can help by letting us know about it in the comments and we will definitely cover that.

Thoughts about using a common Footer

If you are using a Framework like one the many I talked about above then you need not worry. However, if you are just using PHP / Python / Classic Asp files to run you website than you might want to have a common Header or Footer file in all your pages so that such common changes can be taken care of easily and also reduce the risk of missing out files pages in the update process.

Image - resourcesforlife.com/docs/item7015

Advertisement







New Year – Change Copyright Year In Your Website Footer In One Go! was originally published on Digitizor.com on January 3, 2014 - 12:59 pm (Indian Standard Time)