Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » JavaScript

document.lastModified help

 
Jump to:  
 
Guest
PostPosted: Mon Jun 02, 2008 4:08 pm    Post subject: document.lastModified help
       
Hi,

I'm using document.lastModified function to return my document last
mod date. The function returns 1-Jan-1970. The problem seems to be
that the file name is index.php instead of index.html. I have some php
includes in the index files. When I change the php file to htm file
the lastModified function works correctly.

Any help?

Thanks
 

 
Bjoern Hoehrmann
PostPosted: Mon Jun 02, 2008 4:08 pm    Post subject: Re: document.lastModified help
       
* dbahlmann@gmail.com wrote in comp.lang.javascript:
Quote:
I'm using document.lastModified function to return my document last
mod date. The function returns 1-Jan-1970. The problem seems to be
that the file name is index.php instead of index.html. I have some php
includes in the index files. When I change the php file to htm file
the lastModified function works correctly.

The value of the attribute depends on the server telling the browser a
Last-Modified date in a Last-Modified header. For static files servers
will typically get the date from the file system, with dynamically ge-
nerated documents that is not an option, so programmers usually have to
set the date from their scripts.
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · LINK
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · LINK
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · LINK
 

 
Jeremy
PostPosted: Mon Jun 02, 2008 7:07 pm    Post subject: Re: document.lastModified help
       
dbahlmann@gmail.com wrote:
Quote:
Hi,

I'm using document.lastModified function to return my document last
mod date. The function returns 1-Jan-1970. The problem seems to be
that the file name is index.php instead of index.html. I have some php
includes in the index files. When I change the php file to htm file
the lastModified function works correctly.

Any help?

Thanks


Not really a Javascript issue, but try putting this at the very top of
your PHP document (MUST be before any whitespace or anything else, or it
won't work):

<?php header("Last-Modified: " . date('D, d M Y H:i:s T',
filemtime(__FILE__)); ?>

(You can also try getlastmod() instead of the filemtime() call, but
there are complaints about it failing under certain conditions).

Jeremy
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

Linki zakładki Zarabianie przez internet leasing Literatura Nowoczesna Mazowieckie