ferret147 Posted March 9, 2009 Share Posted March 9, 2009 I have some php in a page which I would like to re-load every 30 seconds, but I don't want to re-load the actual page. Here is the code I wish to re-load <?php $scores = file_get_contents("http://www.domain.com/text.txt"); $p1score = substr("$scores", -33, -30); $p2score = substr("$scores", -30, -27); $break = substr("$scores", -27, -24); $current = substr("$scores", -24, -23); $p1frames = substr("$scores", -23, -20); $p2frames = substr("$scores", -20, -17); $frameNO = substr("$scores", -17, -15); echo $p1score; echo $p2score; echo $break; echo $current; echo $p1frames; echo $p2frames; echo $frameNO; ?> Is this possible at all? or am I barking up the wrong tree Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 9, 2009 Share Posted March 9, 2009 Yes, it is possible. Don't ask me for details though My JavaScript skills are lacking. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 9, 2009 Share Posted March 9, 2009 put this php code into it's own file, let's call it subpage.php. then, in your page, put an iframe: <ifram id="subpage" src="subpage.php"></iframe> <script type="text/javascript"> var subpage; window.onload = function(){ subpage = document.getElementById('subpage'); setInterval('subpage.contentWindow.location.reload()',30000); //Refresh every 30 seconds } </script> Quote Link to comment Share on other sites More sharing options...
ferret147 Posted March 9, 2009 Author Share Posted March 9, 2009 Yeah I didn't want to go down the iFrame rout for loads of reasons! I can do it with a iFrame and a simple HTTP-EQUIV="REFRESH" content="30; no need for any javascript. Oh well, thanks for looking anyway Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 10, 2009 Share Posted March 10, 2009 personally, i would use AJAX, but i thought i would keep it simple with the IFRAME Quote Link to comment Share on other sites More sharing options...
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.