<script>
<!--
document.write("<center>");
document.write("<FONT COLOR=#ffffff>");
document.write("This page was last updated on "+document.lastModified);
document.write("</FONT>");
document.write("</center>");
// -->
</script>
which it did. However on the new machine it only shows the current date
& time. Obviously I have missed something iin the apache setup that will
make it display the the correct file creation/modification date - anyone
tell me what it is?
Many Thanks!
--
TTFN
Jim
"Life's tough......It's even tougher if you're stupid."
--John Wayne
That's exactly the construct that I've been using for years
(document.lastModified) and it has worked across all versions of Apache
running under OS/2, Linux and Windows XP. I've never had to do anything
special with apache.
What do you get for the date and time when you display the file? One
thing that might cause this effect would be if you were somehow picking
up the date of last reference, but why this should be happening is a
mystery!
--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
I get the current date & time!
One thing I am beginning to suspect is that my pages now have php
embedded in them and I am wondering if the current date and time is
displayed because of the php generating stuff?
--
TTFN
Jim
A good plan violently executed today is better than a perfect plan
executed tomorrow.
-- George S. Patton
Then you may want to use a PHP solution:
<?php
$last_modified = filemtime("map.html");
print(" Last changed: ");
print(date("F j, Y - h:i A", $last_modified));
?>
--
Ed Mullen
http://edmullen.net
Boycott shampoo! Demand the REAL poo!
<h4>Page last modified: <?=date ("j\<\s\u\p\>S\<\/\s\u\p\> F Y H:i:s",
getlastmod()); ?></h4>
Excellent !
Any way of truncating the info to remove the timestamp ?
ie just show - 27th October 2009 - on the page.
--
Nice! I would have thought that just substituting it for the scrip
section would have worked but it just causes a dreaded white page error
- what have I missed here?
An even more elegant solution!
--
TTFN
Jim
"There is NO job in the Field Artillery for the weak, the
timid or the indecisive."
-- Unknown
Most of my "White page errors" are because I have an unmatched quote, or
tag, such as:
<SCRIPT SRC=/debug.js><SCRIPT>
>>
>> Then you may want to use a PHP solution:
>>
>> <?php
>> $last_modified = filemtime("map.html");
>> print(" Last changed: ");
>> print(date("F j, Y - h:i A", $last_modified));
>> ?>
>>
>>
> To make this a bit more generic, ie not having to enter the filename,
> add this to you html code:-
>
> <h4>Page last modified:<?=date ("j\<\s\u\p\>S\<\/\s\u\p\> F Y H:i:s",
> getlastmod()); ?></h4>
Nice! Interesting tidbit though. It works on my online server (PHP
version 4.4.9) but not on my local server (PHP v. 5.2.6). Locally it
just displays - Page last modified: followed by the PHP code.
--
Ed Mullen
http://edmullen.net
"An ounce of practice is worth more than tons of preaching." - Mohandas
Gandhi
After looking it up I'm guessing it doesn't work on my local machine
because it's Windows, not Linux/Unix as my online server.
--
Ed Mullen
http://edmullen.net
If it weren't for the gutter, my mind would be homeless.
Not sure. Do you have a URL for a test page we could look at?
--
Ed Mullen
http://edmullen.net
Does the name Pavlov ring a bell?
Just remove the H:i:s from the formatting string to remove the time and
remove the S and the <sup></sup> from jS to stop the th after the day
number if you don't want that bit.
I did a test page using the three different methods: The OP's
javascript, the one I suggested using filemtime and Ian's using
getlastmod. I just checked the page about an hour and twenty minutes
after uploading it to my host (Linux). The other two times are correct
but the javascript version shows the current time (same problem as OP had).
http://edmullen.net/root_example.php
Refresh the page and you'll see what it's doing. Wonder what's up with
that.
--
Ed Mullen
http://edmullen.net
Why can't women put on mascara with their mouth closed?
Interesting. The page displays identically in: SeaMonkey 2, Firefox 3
and IE8.
In Opera 9.64 the javascript line says:
"Using javascript - This page was last updated on January 1, 1970 GMT" !!!
In Safari (Windows) 3 it says:
"Using javascript - This page was last updated on" - and, yes, I do have
javascript enabled in Safari. ;-)
--
Ed Mullen
http://edmullen.net
When it rains, why don't sheep shrink?
Thanks.
Exactly the way I wanted it.
<p><?=date ("jS\ F Y", getlastmod()); ?></p>
Dropped it straight into my PHP footer, job done.
--