Forum Moderators: coopster

Message Too Old, No Replies

Returning correct last modified headers in PHP

for includes and DB information

         

jamie

10:44 am on May 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



there has been a lot of interest in PHP caching and headers in this forum recently.

i am about to start writing a simple CMS and wanted to check that i had a correct handle on how to return the last modified header for a php page with a DB connection:

* determine the $HTTP_IF_MODIFIED_SINCE for each include
* determine the $HTTP_IF_MODIFIED_SINCE for the script itself
* determine the last modified date of a mysql db record by accessing the TIMESTAMP field

> find out which of these is the most recent and return that as the header(Last-Modified:)

* in order to access the database to find out the TIMESTAMP of the DB field, i would have to buffer the complete output of the script before sending to the browser - this would enable the header to be sent first, even after accessing the DB?

am i halfway there? ;-)

cheers

jamie

11:30 am on May 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



sorry i got the wrong end of the wrong stick there, it should read the

filemtime for the $HTTP_IF_MODIFIED_SINCE

as the $HTTP_IF_MODIFIED_SINCE is what the browser sends when it requests a page (if i understand correctly)