opus74 Posted May 5, 2007 Posted May 5, 2007 I read dallara's question in the forum, and I have a similar ??. I acccess a radar image on my site, what I would like to do is: 1. user clicks on "view radar" 2. radar page & image loads 3. page immediately reloads 4. page displays & just sits there. 5. There is a <meta http-equiv="refresh" content="420"> in the radar page code to refresh the image after 7 minutes when the radar updates. The problem is, currently, a visitor gets an old image and then has to wait 7 minutes for current. I really don't want to deal with a whole lot of caching/non-caching if I can avoid it. Just a "simple" reload?? Your thoughts & suggestions are appreciated. Quote
carbonize Posted May 5, 2007 Posted May 5, 2007 (edited) I would say either the meta refresh and PHP or Javascript. At the VERY start of the page you'd put ><?php $metaTag = ''; if (empty($_COOKIE['refreshed'])) { $metaTag = '<meta http-equiv="refresh" content="0">'; setcookie('refreshed', 1); } ?> Then where the meta refresh tag goes put ><?php echo $metaTag; ?> This way the meta refresh tag should only appear the first time the page is loaded. I'd recommend this method over the javascript as a few may have javascript turned off. Edited May 5, 2007 by carbonize Quote
opus74 Posted May 8, 2007 Author Posted May 8, 2007 (edited) Hmm, I must be doing this wrong, it is displaying : 'setcookie('refreshed', 1); at the top of the page ...... Edited May 8, 2007 by opus74 Quote
opus74 Posted May 10, 2007 Author Posted May 10, 2007 Did you copy my code exactly ? Yes, just after <head>. Here's a shot....GIF killed the graphics ...... sorry, I don't have upload permission here ... but it puts the 'setcookie('refreshed', 1); at the top of the page. Quote
carbonize Posted May 10, 2007 Posted May 10, 2007 No ><?php $metaTag = ''; if (empty($_COOKIE['refreshed'])) { $metaTag = '<meta http-equiv="refresh" content="0">'; setcookie('refreshed', 1); } ?> That needs to be the very first thing on the page. Nothing before it. No white space, no HTML, nothing. Quote
Bob Crabb Posted May 10, 2007 Posted May 10, 2007 Opus -- I think that the problem might be that you put php code in a page that has an .html or .htm extension. If you rename the page to a .php extension then the code that Carbonize gave you will work fine. Please note: If the page has been indexed by the search engines, or saved by users, then you will also want to put in a redirect for the "whatever_the_name_is.html" to "whatever_the_name_is.php". Quote
TCH-Thomas Posted May 10, 2007 Posted May 10, 2007 Sidenote... Images can not be uploaded into the posts (as attachments). They must be linked/inserted into the posts from your own server space etc. Quote
carbonize Posted May 10, 2007 Posted May 10, 2007 Personally I'd recommend something like imageshack.us for times like this where you want to post a picture on a forum that has attachments disabled. Quote
TCH-Don Posted May 11, 2007 Posted May 11, 2007 Opus -- I think that the problem might be that you put php code in a page that has an .html or .htm extension. If you rename the page to a .php extension then the code that Carbonize gave you will work fine. Please note: If the page has been indexed by the search engines, or saved by users, then you will also want to put in a redirect for the "whatever_the_name_is.html" to "whatever_the_name_is.php". If the page does have an .html extension put this in your .htaccess flie to make it work without changing the extension. >AddHandler application/x-httpd-php .htm .html And search engines indexing won't matter. Quote
Bob Crabb Posted May 11, 2007 Posted May 11, 2007 If the page does have an .html extensionput this in your .htaccess flie to make it work without changing the extension. >AddHandler application/x-httpd-php .htm .html And search engines indexing won't matter. Don, I learn something new every time I read this forum. Quote
opus74 Posted May 16, 2007 Author Posted May 16, 2007 Thanks everyone, I'm still working on this as time permits. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.