NationStates Jolt Archive


Make Pages Automatically Refresh

Tech Plug
14-06-2005, 15:16
I know some of you notice when you click on a link that many of the things are out of date: for example I just changed my settings and I went back to check and make sure I picked the right thing, but they were out of date so I had to refresh the frame to see what I picked. The same holds true for the issues page too: I voted on an issue for my nation but when I went to see what the status was I had to refresh to see that it was pending.

Well anyways I know a little about PHP (yes I know the site runs on CGI scriptS) so I figured I would post a little piece of code and maybe you could put it in your header file after some modifications (if you use header files and can change this PHP stuff to CGI - I guess that is Perl??...if so you might no have to change very much at all):

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header ("Pragma: no-cache");



Basically you put this at the top of your header file and it tells the server that the page expired a long time ago, was just now modified, and you better go get a new version of the page.
Fsan Lmo
14-06-2005, 15:37
I know some of you notice when you click on a link that many of the things are out of date: for example I just changed my settings and I went back to check and make sure I picked the right thing, but they were out of date so I had to refresh the frame to see what I picked. The same holds true for the issues page too: I voted on an issue for my nation but when I went to see what the status was I had to refresh to see that it was pending.

Well anyways I know a little about PHP (yes I know the site runs on CGI scriptS) so I figured I would post a little piece of code and maybe you could put it in your header file after some modifications (if you use header files and can change this PHP stuff to CGI - I guess that is Perl??...if so you might no have to change very much at all):

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header ("Pragma: no-cache");



Basically you put this at the top of your header file and it tells the server that the page expired a long time ago, was just now modified, and you better go get a new version of the page.

ok thanks for the information bro! :)
WYrd-ness
14-06-2005, 19:23
trouble with that idea is that it will increase the load on the server dramatically and we'll start seeing near-permanent downtime. For most of the time it is sufficient to see the page that's in your cache and if you want to see fresh info then you can refresh with Ctrl+F5.

Auto cache clearing is mainly intended for one or two pages on a small site that are updated regularly (or perhaps a frame with news in it)

sorry to be so pessimistic but i don't think it's gonna happen
SalusaSecondus
15-06-2005, 03:18
I know some of you notice when you click on a link that many of the things are out of date: for example I just changed my settings and I went back to check and make sure I picked the right thing, but they were out of date so I had to refresh the frame to see what I picked. The same holds true for the issues page too: I voted on an issue for my nation but when I went to see what the status was I had to refresh to see that it was pending.

Well anyways I know a little about PHP (yes I know the site runs on CGI scriptS) so I figured I would post a little piece of code and maybe you could put it in your header file after some modifications (if you use header files and can change this PHP stuff to CGI - I guess that is Perl??...if so you might no have to change very much at all):

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header ("Pragma: no-cache");



Basically you put this at the top of your header file and it tells the server that the page expired a long time ago, was just now modified, and you better go get a new version of the page.

We already include headers on these pages telling your computer not to cache them and to always request a new copy.