yoi55 Posted February 6, 2007 Share Posted February 6, 2007 I run the web site for my Boy Scout Troop and it has different pages for each adult leader (scoutmaster, assistant, etc.). In each of these pages, they put news items and things that need to be done by the next meeting. My problem is that sometimes when people go to these pages, it doesn't grab the newest version of the page and needs to be manually refreshed to get it. I want a way to automatically retrieve the newest version of the page off the server every time the page is loaded. Somebody told me that PHP might be able to accomplish this, but I have been unable to find out exactly how (if it is indeed possible). I know that a preference can be set in the browser to have it get the newest version of the page on every visit, but I don't want to have to try and tell all the parents how to do this and also take the chance of them breaking their browser. Link to comment https://forums.phpfreaks.com/topic/37336-solved-always-loading-the-newest-version-of-a-page/ Share on other sites More sharing options...
Balmung-San Posted February 6, 2007 Share Posted February 6, 2007 In the top of your php code insert: header("Cache-Control: no-cache, must-revalidate"); That should tell the browser not to cache the page. Link to comment https://forums.phpfreaks.com/topic/37336-solved-always-loading-the-newest-version-of-a-page/#findComment-178477 Share on other sites More sharing options...
yoi55 Posted February 7, 2007 Author Share Posted February 7, 2007 Ok, I put that code as follows: <html> <?php header("Cache-Control: no-cache, must-revalidate"); ?> ... But it still does not load the newest version. I manually refreshed the page to make sure it got the PHP code then I made changes to the page. I clicked on the link everyone will use to get to the page, but it did not load the new version...I still have to manually refresh it. Link to comment https://forums.phpfreaks.com/topic/37336-solved-always-loading-the-newest-version-of-a-page/#findComment-179303 Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 That's because you have it in the wrong place. header() must always come before anything is output. Link to comment https://forums.phpfreaks.com/topic/37336-solved-always-loading-the-newest-version-of-a-page/#findComment-179309 Share on other sites More sharing options...
yoi55 Posted February 19, 2007 Author Share Posted February 19, 2007 That worked great, thanks! Sorry for not getting back sooner Link to comment https://forums.phpfreaks.com/topic/37336-solved-always-loading-the-newest-version-of-a-page/#findComment-188812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.