Forum Moderators: coopster
I have a page that updates every 3 or 4 minutes. The page is accessed quite frequently and I am looking to build a process that saves a static copy if the data hasn't updated yet. When a user hits the page and the data has updated then I need to create a new static copy.
My question is how do I build an html version of a PHP dynamically created page?
I'm not looking for a PHP cache script like PHP Accelerator or Zend Accelerator. I just need to know how to build a static copy of a page from a dynamic php page. If that makes sense.
Thanks
Anyway, good luck!
BTW, here's all the filesystem functions [us3.php.net] ;)
What I meant was, why aren't you just keeping it dynamic. It depends on what you have being done on the page, but this solution seems unnecessary. Again, it depends. If it's just dynamic text, or pulling info from a db, it seems unnecessary. If you are doing image manipulations each time the page loads (or another server-intensive function), then it would make sense to make a static copy. Either way you can still use cache-control and expire [w3.org] by sending headers [us2.php.net].
>>Also, I couldn't find it right away but doesn't fwrite have a character or byte limit?
Not that I am aware of. You can set your own using the optional parameter (length), though.
Make sure to Optimize [dev.mysql.com] your tables and queries to get the most out of them. I'm sure you can reduce the amount of queries if you wanted to. :)
You may also want to take a look at PHP Performance tips. [webmasterworld.com]