Virtualei Posted November 9, 2011 Report Posted November 9, 2011 Hi all, I am looking for a bit of help please. I have the live flight board from this forum but i would like it to auto refresh. I have only managed to refresh the whole page by using <!-- n = seconds --> <meta http-equiv="refresh" content="n" /> Can anyone help Thanks Quote
Moderators mark1million Posted November 10, 2011 Moderators Report Posted November 10, 2011 I use jquery i think, put the board between a div that is set to refresh every xx seconds Quote
freshJet Posted November 10, 2011 Report Posted November 10, 2011 Try this: <script type="text/javascript"> function Ajax(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("No AJAX!?"); return false; } } } xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText; setTimeout('Ajax()',10000); } } xmlHttp.open("GET","ab.php",true); xmlHttp.send(null); } window.onload=function(){ setTimeout('Ajax()',10000); } </script> <div id="ReloadThis"> <!--Flightboard PHP code goes here--> </div> Quote
Virtualei Posted November 10, 2011 Author Report Posted November 10, 2011 Try this: <script type="text/javascript"> function Ajax(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("No AJAX!?"); return false; } } } xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText; setTimeout('Ajax()',10000); } } xmlHttp.open("GET","ab.php",true); xmlHttp.send(null); } window.onload=function(){ setTimeout('Ajax()',10000); } </script> <div id="ReloadThis"> <!--Flightboard PHP code goes here--> </div> Thanks for getting back to me guys. I tried this code and i am getting the error ab module doesnt exist. am i doing something wrong. I put this code in my recent_bids.tpl as that is where my flightboard is. Thanks Quote
Moderators mark1million Posted November 10, 2011 Moderators Report Posted November 10, 2011 Add this script to the top of your tpl, <script type="text/javascript"> setInterval(function() { $("#fboard").load(location.href+" #fboard>*",""); }, 60000); </script> Place your flightboard between these divs, <div id="fboard"><---Place your include here---></div> 2 Quote
Virtualei Posted November 10, 2011 Author Report Posted November 10, 2011 Add this script to the top of your tpl, <script type="text/javascript"> setInterval(function() { $("#fboard").load(location.href+" #fboard>*",""); }, 60000); </script> Place your flightboard between these divs, <div id="fboard"><---Place your include here---></div> Hi Mark, Thanks for answering. I put the above code in my recent_bids.tpl and then in my frontpage_main.tpl i put <div id="fboard"><?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?></div> Does this look right. Quote
Virtualei Posted November 10, 2011 Author Report Posted November 10, 2011 Thats it sorted. I owe you again Mark thank you +1 Thanks itrobb for your help also:) Quote
Industrialshadow Posted December 21, 2011 Report Posted December 21, 2011 Hi i will also autorefresh my Flightboard. I have putted in here frontbds_recentbids.tpl <script type="text/javascript"> setInterval(function() { $("#fboard").load(location.href+" #fboard>*",""); }, 60); </script> <script type="text/javascript"> function Ajax(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("No AJAX!?"); return false; } } } xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText; setTimeout('Ajax()',10000); } } xmlHttp.open("GET","ab.php",true); xmlHttp.send(null); } window.onload=function(){ setTimeout('Ajax()',10000); } </script> <?php header("Content-Type: text/html; charset=utf-8"); ?> <h2><center> Live Flights Board </center></h2> <div align="center" id="ReloadThis" id="fboard" > <table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F"> <tr> <th align="center" style="background-color: #171717; width: 3.5%;"> </th> <th width="10%" align="center" style="background-color: #171717;"><font color=#FFFFFF>Flight</font></th> <th width="30%" align="center" style="background-color: #171717;"><font color=#FFFFFF>Departure</font></th> <th width="30%" align="center" style="background-color: #171717;"><font color=#FFFFFF>Arrival</font></th> <th width="5%" align="center" style="background-color: #171717;"><font color=#FFFFFF>Aircraft</font></th> <th width="18.5%" align="center" style="background-color: #171717;"><font color=#FFFFFF>Status</font></th> </tr> <?php $results = ACARSData::GetACARSData(); if (count($results) > 0) { foreach($results as $flight) { ?> <tr> <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://www.lausitz-aircargo.de/lib/skins/ObsessBlue/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://www.lausitz-aircargo.de/lib/skins/ObsessBlue/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://www.lausitz-aircargo.de/lib/skins/ObsessBlue/dots_yellow.gif'>"; } ?></td> <td align="center"><font color=ff9610><?php echo $flight->flightnum;?></font></td> <td align="center"><font color=ff9610><?php echo $flight->depname;?></font></td> <td align="center"><font color=ff9610><?php echo $flight->arrname;?></font></td> <td align="center"><font color=ff9610><?php echo $flight->aircraftname;?></font></td> <td align="center"><font color=ff9610><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></font></td> </tr> <?php } } else { ?> <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #ffffff;">No Flights in Progress!</td></tr> <?php } ?> </table> </div> <p><i><center>The actual, flights and flights completed in the last <?php echo Config::Get('ACARS_LIVE_TIME') ?> minutes.</center><br /></p> <p align="center"><object id='RealtimeNG' codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' align='middle' style='width:600px;height:328px' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' salign='t'><param name='Movie' value='http://www.utr-online.com/RealtimeNG.swf?refApt=EDAB'><param name='bgcolor' value='#000000'><param name='menu' value='false'><param name='allowScriptAccess' value='always'><param name='FlashVars' value='fontcolor1=DDDDDD&fontcolor2=000000&fontcolor3=006699&network=VATSIM&NRLines=15&switch=15&switchnetwork=0&locked=0&range=0&sound=0&logos=1'><embed src='http://www.utr-online.com/RealtimeNG.swf?refApt=EDAB' allowScriptAccess='always' FlashVars='fontcolor1=DDDDDD&fontcolor2=000000&fontcolor3=006699&network=VATSIM&NRLines=15&switch=15&switchnetwork=0&locked=0&range=0&sound=0&logos=1' quality='high' bgcolor='#000000' width='600' height='328' name='RealtimeNG' menu='false' align='middle' salign='t' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></p> <div id="mainbox"> <h3><center><center> Currently booked Flights </center></h3> <div align="center"> <?php if(!$lastbids) { echo '<p align="center">No flights have currently been booked</p>'; return; } ?> <table width="100%" border="0" bordercolor="#FFFFFF" class="tablesorter" id="tabledlist" bgcolor="006699"> <thead> <tr align="center" valign="middle" bgcolor="#006699"> <th height="25" width="15%"><div align="center"><font color=#000000>Flight Number</font></div></th> <th height="25" width="13%"><div align="center"><font color=#000000>Depart</font></div></th> <th height="25" width="13%"><div align="center"><font color=#000000>Arrive</font></div></th> <th height="25" width="20%"><div align="center"><font color=#000000>Pilot Name</font></div></th> <th height="25" width="15%"><div align="center"><font color=#000000>Aircraft</font></th> <th height="25" width="12%"><div align="center"><font color=#000000>Tail No.</font></div></th> <th height="25" width="12%"><div align="center"><font color=#000000>Flight Time</font></div></th> </tr> </thead> <tbody> <?php foreach($lastbids as $lastbid) { ?> <tr align="center" valign="middle" bgcolor="#006699"> <td height="25" width="15%" align="center"><font color=#FFFFFF><?php echo $lastbid->code . $lastbid->flightnum; ?></font></a> </td> <td height="25" width="13%" align="center"><span><font color=#FFFFFF><?php echo $lastbid->depicao; ?></font></span></td> <td height="25" width="13%" align="center"><span><font color=#FFFFFF><?php echo $lastbid->arricao; ?></font></span></td> <?php $params = $lastbid->pilotid; $pilot = PilotData::GetPilotData($params); $pname = $pilot->firstname; $psurname = $pilot->lastname; ?> <td height="25" width="20%" align="center"><span><font color=#FFFFFF><?php echo $pname; ?> <?php echo $psurname; ?></font></span></td> <td height="25" width="15%" align="center"><span><font color=#FFFFFF><?php echo $lastbid->aircraft; ?></font></span></td> <td height="25" width="12%" align="center"><font color=#FFFFFF><?php echo $lastbid->registration?></font></td> <td height="25" width="12%" align="center"><span><font color=#FFFFFF><?php echo $lastbid->flighttime; ?> Hours</font></span></td> </tr> <?php } ?> </tbody> </table> </div> <hr> </div> but when its reloading i become the message URL not found. Can anybody helpt to solve this thanks 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.