Re: [phplib-users] delivering static content with phplib
Brought to you by:
nhruby,
richardarcher
From: Layne W. <la...@dr...> - 2007-07-02 15:03:38
|
>Not to be confused with my other email; this one deals with a=20 >webpage that is entirely static, but I've used php to simply=20 >the html coding. There is a lot of repetitious html in the=20 >page, so I used php arrays to make sure it all gets generated=20 >cleanly/consistently. Is there a phplib feature, or some other=20 >php functions that I can use to give browser the timestamp of=20 >the php so the browser can think the page is static instead of=20 >dynamic? This way, when I change the page, timestamp changes=20 >and browser should cache page until I make a change. You can set the last modified header. Here is the group of=20 headers I've used in the past to make downloaded files "static".=20 If you have this code in an include, you'll need to change the=20 target of filemtime() to point to the page file. header("Expires: " . gmdate("D, d M Y H:i:s", time() + 1440 *=20 60) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s",=20 filemtime(__FILE__)) . " GMT"); header("Cache-Control: public"); header("Cache-Control: max-age=3D" . 1440 * 60, false); header("Pragma: public"); --=20 Layne Weathers |