This is product of my counter script: [ 490 ]
University of Turku

Last modified

It would be nice to know when a web page is last updated. Here I have two little JAVASCRIPTS to help the customer know how fresh the page is.
The first writes the information up in to the TITLE BAR (No beer there).
Another script writes it to the page text area.

Message in the title bar

Rememeber to make dummy < title > tags. It seems that this dont work, if you dont have them:

	< TITLE > DUMMY < /TITLE>

The code, It can be inserted in the < HEAD > < /HEAD > -part of the page after the < /TITLE > -tag:

	< script language=javascript >
	< !-- Begin

	 // Msg to the titlebar
		var msg="Last modified: " + document.lastModified;
		document.title = msg;

	// This part gets the IP
		var ip = '< !--#echo var="REMOTE_ADDR"-- >';

	// This part is for the status bar
		window.defaultStatus = "Your IP address is "+ip;

	// end hide -- > Sorry, no Java for you today. Your browser isn't Java compatible.
	< /script >

As you see, here is a little extra. The code above prints customers IP address down to the status bar (no beer either).

BTW: DO NOT make moving texts in the title bar. They eat CPU time and irritate customers. I tested it and had many kinds of problems in customer browsers !


Message in the text area

Here is an example:

As you can see, this code can be inserted anywhere in the page:

	< script language=javascript>
	<!-- Begin
		document.write("Last modified: ");
		document.write(document.lastModified);

	// end hide --> Sorry, no Java for you today. Your browser isn't Java compatible.
	< /script >
	

Another files update info

If you want to print the date of last modify of some other file, you can use this simple tag:

 < !--#flastmod file="SOMEOTHERFILE.EXT" -- > 
This is no script, it is just a normal HTML tag.
As an example here is the information for index.shtml in this directory:

Thursday, 22-Sep-2011 09:49:13 EEST

The date format can be set by tag

	< !--#config timefmt="%dd%mm%y %R" -- >
This line contained an exaple which produces this kind of result:
22d09m11 09:49

Another parameters in the tag

	< !--#config timefmt="Day = %d, Month = %m, Year = %y, 12-hour time = %r" -- >
produce different result:
Day = 22, Month = 09, Year = 11, 12-hour time = 09:49:13 AM

There is pages describing the parameters, so I don't continue about them.

Of course you can use this tag to print the info for the open page too, but I'll recommend those scripts. Specifically so, if you work like me: I have one file, which contains a frame for the new pages. When I start building a new page, I take this file, copy it with a new name and start editing. Now there is no need to edit the name of the file inside the page. I can even change the name of the page afterwards, and still the information stays correct.

PTMUSTA at UTU.FI