ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-lib
php-lib
Re: [phplib-users] delivering static content with phplib
by Layne Weathers other posts by this author
Jul 2 2007 8:03AM messages near this date
[phplib-users] delivering static content with phplib | [phplib-users] OT: caching static content
> Not to be confused with my other email; this one deals with a 
> webpage that is entirely static, but I've used php to simply 
> the html coding.  There is a lot of repetitious html in the 
> page, so I used php arrays to make sure it all gets generated 
> cleanly/consistently.  Is there a phplib feature, or some other 
> php functions that I can use to give browser the timestamp of 
> the php so the browser can think the page is static instead of 
> dynamic?  This way, when I change the page, timestamp changes 
> and browser should cache page until I make a change.

You can set the last modified header. Here is the group of 
headers I've used in the past to make downloaded files "static". 
If you have this code in an include, you'll need to change the 
target of filemtime() to point to the page file.

header("Expires: " . gmdate("D, d M Y H:i:s", time() + 1440 * 
60) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", 
filemtime(__FILE__)) . " GMT");
header("Cache-Control: public");
header("Cache-Control: max-age=" . 1440 * 60, false);
header("Pragma: public");

-- 

Layne Weathers

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
phplib-users mailing list
phplib-users@[...].net
https://lists.sourceforge.net/lists/listinfo/phplib-users
Thread:
Frank Bax
Layne Weathers

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved