Soundman9 Posted March 7, 2016 Report Posted March 7, 2016 Hi We have some code to pull the airline logo for our recent flights board - but I would like to return the same for the live flight info. For some reason the same code does not work and instead of returning the airline logo it returns VTA as the answer all the time for every flight and displays the airline logo. The code we use for the recent flight board is below and works fine. I have tried editing it but cannot find the solution. Should it be looking at the $PIREP data or something else? Like I say this code works on recent flights but not live flights. <?php echo '<img class="img-responsive" src="'.fileurl('/airlines/'.$pirep->code.'.png').'" alt="'.$airline->name.'" />'; ?> Thanks Quote
web541 Posted March 8, 2016 Report Posted March 8, 2016 Best option would be to do this http://forum.phpvms.net/topic/21412-showing-airline-logos-on-live-map-solved/#entry114903 then you will end up with this <img class="img-responsive" src="<?php echo SITE_URL;?>/airlines/<%=flight.flightcode%>.png" alt="<%=flight.flightcode%>"> Quote
Soundman9 Posted March 8, 2016 Author Report Posted March 8, 2016 Thanks for your response. That code did not work for us. We are not trying to input the logo on the live flight map bubble. We have a live flights board which we are trying to post it in. I have images below of the issue with the new code and also how it displays normally with the wrong logo. With the old code you can see it looks for VTA.png for every flight instead of the airline icao .png Quote
Moderators servetas Posted March 8, 2016 Moderators Report Posted March 8, 2016 Can you post the part of code for the current flights section? Quote
Soundman9 Posted March 8, 2016 Author Report Posted March 8, 2016 The code for the recent flights is posted in the top of the thread. If you need anything more please let me know. It seens to return the VA icao VTA rather than the airline logo such as AAL Quote
Moderators servetas Posted March 8, 2016 Moderators Report Posted March 8, 2016 No, I would need the code for the current flights in orderto check the variable you are using inorder toparse the data for the current flights section. Quote
Soundman9 Posted March 8, 2016 Author Report Posted March 8, 2016 At the moment i am using the same code as the recent flights section which returns VTA. So the variable is $pirep code Quote
Soundman9 Posted March 8, 2016 Author Report Posted March 8, 2016 <?php echo '<img class="img-responsive" src="'.fileurl('/airlines/'.$pirep->code.'.png').'" alt="'.$airline->name.'" />'; ?> Quote
web541 Posted March 8, 2016 Report Posted March 8, 2016 I think what Servetas is trying to say is that could you please post your code for the whole section for current flights and not just the image link Quote
Members Vangelis Posted March 8, 2016 Members Report Posted March 8, 2016 first the code for the acars table is different than the pireps table as you can see you have 2 flights 1 is AAL80 and 2 is SIA321 so what do you have to do is split the airline code from the flight number for example for AAL80 will be a) AAL and b)80 and now you can use the code assumed you have it named AAL.png that can be done with the included function SchedulesData::getProperFlightNum(flightnumber) so in your case it will be $ProperFN=SchedulesData::getProperFlightNum($pirep->flightnum); and to show the image <?php echo '<img class="img-responsive" src="'.fileurl('/airlines/'.$ProperFN[code].'.png').'" alt="'.$airline->name.'" />'; ?> Quote
Soundman9 Posted March 8, 2016 Author Report Posted March 8, 2016 Vangelis, your a wizard That worked perfectly - thanks very much for your input its greatly appreciated! Quote
John2360 Posted March 27, 2016 Report Posted March 27, 2016 Hi, I have a similar problem. I want to put up the logos of the airlines that are currently flying. I have tried using this code but it is trying to show, "http://sta-va.com/airlines/.png" not with airline name in it. Is it that I have put the code in wrong? Thank you very much, John Finberg Code: https://gyazo.com/af10ada27e9e0e5c7eed7c5f36fa8c53 Page: https://gyazo.com/33364823e54f9a5c7639fce2b45818b3 Quote
Moderators servetas Posted March 29, 2016 Moderators Report Posted March 29, 2016 Change the brackets of line 156 from $pirep->flightnum to $flight->flightnum. Quote
John2360 Posted May 29, 2016 Report Posted May 29, 2016 Hi, I tried making that change but it did not work. It still returns the same error. Sorry for the really late response for some reason I was not following the topic. Thank you very much, John Finberg Quote
Members Vangelis Posted May 29, 2016 Members Report Posted May 29, 2016 (edited) Als you can paste your code here at the forum with the code tag so it will be easyer for us to help you Here your code Edited May 29, 2016 by Vangelis Quote
John2360 Posted May 29, 2016 Report Posted May 29, 2016 Hi, Here is the code I am using. <?php $ProperFN=SchedulesData::getProperFlightNum($flight->flightnum); ?> <script type="text/html" id="acars_map_row"> <tr class="<%=flight.trclass%> table-data"> <td><a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a></td> <td><%=flight.flightnum%></td> <td><%=flight.depicao%></td> <td><%=flight.arricao%></td> <td><%=flight.phasedetail%></td> <td><%=flight.alt%></td> <td><%=flight.gs%> </tr> </script> Thank you very much, John Finberg 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.