views:

343

answers:

6

We have some old html files on the website that have copyright year on the bottom of the page (from include file). We are trying to find a way to update that dynamically to current year so the include file does not need to be edited every year. We are using asp and .net on the same server so there might be ways to use those technologies to accomplish this.

I am thinking of several ways this could be possibly accomplished but I am sure I am missing something. Maybe some sort of token replacement that could be done or something.

Here are few options that I am thinking about.

  1. A process on the server that will check for year change once a day and rewrite the include files or would be triggered once a year by a scheduled task.

  2. A web application that when accessed would check out the current year and write it to include files. It would need a permission to write to the disk. Then access it with something like wget with a scheduled task once a year or manually when it is time.

  3. Embed the javascript as part of the non-asp include files that would update the year dynamically before pages finish loading. This is among the easiest ways to accomplish this, but probably not the best.

  4. Finding a way to process files before they are embedded.

  5. Enable asp processing on html files. This is undesireable due to server load it might cause.

A: 

Assuming you want to keep them in HTML and not some dynamic language (which sounds like a good idea), I would convert them all to use server side includes, modify all of the HTML files (a one time hit) to include the copyright information and then put that in one include file. Then, each year you only need to update one file and that could be easily automated.

Rob Prouse
I believe he said that this is what he already does.
DMKing
yes essentially this is what happens now
Salt Packets
+3  A: 

Umm..how much does it cost you to tweak the include file every year?

How much is it going to cost you to develop, test and debug the solution?

AnthonyWJones
I agree with you 100%, never the less i have find the solution. So it is a matter of doing it the best way. I guess this is what happens when those who want something done, do not understand what is involved.
Salt Packets
+3  A: 

Convert to ASP classic (just change the file extension), use this:

<%=DatePart("yyyy", Now())%>

Whatever you do, do it server side. With Javascript, you're relying on the user's system clock. Surrendering control to the user isn't a good idea when it comes to any kind of legal stuff.

Mike Robinson
A: 

This question has to be a joke, surely?

AmbroseChapel
A: 

IANAL, but I question if an auto-generated copyright statement is valid?

If you are declaring a copyright, I think the least you can do is date it properly, yourself, and not leave it up to a computer.

The next best thing would be to put a copyright notice, undated.

abelenky
Good point. I am going to bring it up, maybe that will shake em up.
Salt Packets
+1  A: 

You could create a batch file that generates the include file based on the current date. Then call that batch file periodically from a scheduled task.

For example a batch file with the following content, writes a copyright notice into "c:\copyright.inc":

echo Copyright (C) %date:~6,4% - My Company > c:\copyright.inc

Note that this works for DD.MM.YYYY date-format. You will probably have to change the "~6,4" part to "~0,4" for YYYY/MM/DD date-formats.

M4N