Re: Using javascript "document.lastmodified" in PHP-include
| From: | hboyce | Date: | Wed, 30 Aug 2000 22:06:25 +0000 |
| Subject: | Re: Using javascript "document.lastmodified" in PHP-include | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14474@lists.php.net to get a copy of this message | ||
> It is a nice thing to include PHP-footers (for example
> include('../html/footer.html') ) but it seems that the javascript
> function document.lastmodified doesn't work correctly when you do this
> (it displays January 1st, 1970)...
The Javascript read-only property Document.lastmodified reflects the
content (if any) of the HTTP header Last-modified: associated with
the document. In the header's absence, document.lastmodified has the
value 0, which is represented as midnight January 1st 1970 - hence
what you are seeing. There is no Last-modified: HTTP header.
You *could* just emit the lastmodified date as HTML output as Andrew
Braund suggests if you've no other reason for wanting
doument.lastmodified to have the right value.
But if you *do* need a valid value for document.lastmodified, the
'proper' fix is to ensure you send a valid HTTP Last-modified:
header, e.g. header("Last-modified: date-string") with a suitable
value for date-string, perhaps derived as Andrew suggested. The
usual warnings about using header() before sending HTML output apply.
David.