Moderators mark1million Posted January 29, 2011 Moderators Report Posted January 29, 2011 Hi everyone i have been working today on a flightboard that reads from the phpvms acars table. The results are below but im still working on some bits and pieces, this code has been based on the release in this post so full credit goes to the author, all i have done is worked and extended the code. once i get it fully functional i will post the code. This board will produce an and image for every acars stage of flight, you cant see it there in the image but the approach and and final calls are gifs that alternate flash. Quote
Moderators mark1million Posted January 29, 2011 Author Moderators Report Posted January 29, 2011 Cheers Jeff, means a lot coming from you Quote
Moderators mark1million Posted January 30, 2011 Author Moderators Report Posted January 30, 2011 HI Guys, Here is my quandary I am hoping someone can help me with. I want the flight board to auto refresh, these are my options i currently have a javascript timer which does the job but If i use a php include the whole page gets refreshed not just the content which i don't really want, if i add the page as a iframe i have to define the width and height and if there ate lots of flights then scroll bars appear which isn't a problem but if there are no flights there is a massive space which has been defined for the iframe, however by adding as an iframe just the frame refreshes and not the whole page, now you can see my problem. I dont want to use the iframe i want to use the include which in my opinion looks better and fits in to however many flight are there or not. I have looked in to the acars map and how that refreshes but i cant seem to use that on this page, i have been searching jquery and javascript include refreshed all morning but cant seem to come up with anything i can use. If anyone would have some suggestions they would be greatly received, in the mean time i will continue to trawl through google And if you want a look at where i am with this its nearly complete apart from the refresh http://www.easyjetva.com Thanks. Quote
piuozorio Posted January 30, 2011 Report Posted January 30, 2011 Hello, i have a refresh flightboard with jquery. I created a single php file with all code of flightboard lets say flightboard.php Then in site header insert (if you dont have yet)<script type="text/javascript" language="javascript" src="URLTOJQUERY/jquery-latest.js"></script> next <script type="text/javascript"> refreshId = null; $(document).ready(function() { $("#YOURDIV").load('PATHTOFILE/flightboard.php'); var refreshId = setInterval(function() { $("#YOURDIV").load('PATHTOFILE/flightboard.php?randval='+ String((new Date()).getTime()).replace(/\D/gi, "")); }, 10000); }); </script> The line with randval... is for IE The 10000 is refresh 10 seconds To show just echo YOURDIV like <div id="YOURDIV"></div> In top of your flightboard.php you need to add the lines at the top to prevent cache i think header("Expires: Mon, 1 Dec 2003 01: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("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Content-Type: text/html; charset=ISO-8859-1"); Hope it helps you 1 Quote
Moderators mark1million Posted January 30, 2011 Author Moderators Report Posted January 30, 2011 I have just been researching jquery, thanks will give that a go and let you know Quote
Moderators mark1million Posted January 30, 2011 Author Moderators Report Posted January 30, 2011 Clearly i have missed something lol Going to have a break for a coffee and come back to it. Quote
piuozorio Posted January 30, 2011 Report Posted January 30, 2011 Or maybe my english is not good to understand :/ My php file is "new" not phpvms The php file starts <?php header("Expires: Mon, 1 Dec 2003 01: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("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Content-Type: text/html; charset=ISO-8859-1"); $link = mysql_connect("localhost", "DBUSERNAME", "DBPASSWORD") or die("Could not connect: " . mysql_error()); mysql_selectdb("DATABASENAME",$link) or die ("Can\'t use dbmapserver : " . mysql_error()); $result = mysql_query("SELECT * FROM PHPVMS_acarsdata WHERE lastupdate > DATE_SUB( NOW() , INTERVAL 2 MINUTE )", $link); while($row = mysql_fetch_array($result)) { $VARIABLE = $row['FIELDYOUWANT']; echo $VARIABLE; } mysql_close(); ?> phpvms already have jquery so you dont need my line <script type="text/javascript" language="javascript" src="URLTOJQUERY/jquery-latest.js"></script> just jump to the next code 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.