Jeff Posted April 27, 2011 Report Share Posted April 27, 2011 This one is getting pretty difficult for me to understand. I am wanting to have a table to show on my site that displays the airline logo instead of the airline name in it. I have the airline logos named as the 2 digit IATA code the same way my airlines are named as well (ex: Southwest= WN, Delta= DL)and they are all .gif images. Is there an easy way to pull this off? Here is how I want to display it. <table align="center" border="0" width="100%"> <thead> <tr> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Airline</font></strong></th> //this will show the airline logo <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Flight</font></strong></th> //this will show the flight number <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Departure</font></strong></th> //this will show the departure airport <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Arrival</font></strong></th> //this will show the arrival airport <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Aircraft</font></strong></th> //this will show the aircraft used <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Flight Time</font></strong></th> //this will show the total flight time <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Submitted</font></strong></th> //this will display the date the pirep was submitted <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Status</font></strong></th> //this will display whether the flight is Pending, Accepted, or Rejected </tr> </thead> Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 28, 2011 Author Report Share Posted April 28, 2011 I know I might need to have a foreach in there somewhere, but not sure the code. Can someone please help me in this? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 28, 2011 Administrators Report Share Posted April 28, 2011 The best way would be to rename it to the ICAO, so you can do something like: <img src="<?php echo fileurl('/lib/images/airlines/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" /> In a place where there is that $airline variable Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 28, 2011 Author Report Share Posted April 28, 2011 Parse error: syntax error, unexpected '<' in /home/virtualf/public_html/lib/skins/ObsessBlue/frontpage_main.tpl on line 67 This is line 67 <img src="<?php echo fileurl('/images/airline/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" /> and this is the whole code: <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table align="center" border="0" width="100%"> <thead> <tr> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Airline</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Flight #</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Departure</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Arrival</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Duration</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Pilot</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Landing Rate</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Aircraft</font></strong></th> </tr> </thead> <tbody> <?php if(count($pireps) > 0) { foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); echo "<tr>"; <img src="<?php echo fileurl('/images/airline/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" /> echo "<td align=center> $pirep->flightnum </td>"; echo "<td align=center> $pirep->depicao </td>"; echo "<td align=center> $pirep->arricao </td>"; echo "<td align=center> $pirep->flighttime </td>"; echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>"; echo "<td align=center> $pirep->landingrate </td>"; echo "<td align=center> $pirep->aircraft </td>"; echo "</tr>"; } } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> </tbody></table> Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 28, 2011 Administrators Report Share Posted April 28, 2011 You're already within PHP so change that <img src into an echo statement... I just posted the general format of it for you Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 29, 2011 Author Report Share Posted April 29, 2011 I keep playing with the code you gave me, but it keeps coming up error after error. Do you have the exact code for it? My airlines codes are 2 digit, same as the images. So if the flight was a Delta (DL) then the image would be DL.gif but somehow it isn't coming up. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted April 29, 2011 Report Share Posted April 29, 2011 Try this. echo '<img src="'.fileurl.'/images/airline/'.$airline->icao.'.gif'.'" alt="'.$airline->name.'"/>'; Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 29, 2011 Administrators Report Share Posted April 29, 2011 echo '<img src="'.fileurl('/images/airline/'.$airline->icao.'.gif').'" alt="'.$airline->name.'" /> Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 29, 2011 Author Report Share Posted April 29, 2011 With Jeffrey's code, I had no errors, but as you see in the attached image, you can see everything shifted to the left. Using Nabeel's code, I get this error... Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in /home/virtualf/public_html/lib/skins/ObsessBlue/frontpage_main.tpl on line 66 Here's how I have it: <table align="center" border="0" width="100%"> <thead> <tr> <th bgcolor="#05305d" border="1"> <span style="font-size: 12px;"><span style="color: rgb(255, 255, 255);">Last 10 Flights</span></span></th> </tr> </thead> </table> <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table align="center" border="0" width="100%"> <thead> <tr> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Airline</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Flight #</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Departure</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Arrival</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Duration</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Pilot</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Landing Rate</font></strong></th> <th align="center" bgcolor="#05305d" border="1"> <strong><font color="#ffffff">Aircraft</font></strong></th> </tr> </thead> <tbody> <?php if(count($pireps) > 0) { foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); echo "<tr>"; echo '<img src="'.fileurl('/images/airline/'.$airline->icao.'.gif').'" alt="'.$airline->name.'" /> //Here's the code echo "<td align=center> $pirep->flightnum </td>"; echo "<td align=center> $pirep->depicao </td>"; echo "<td align=center> $pirep->arricao </td>"; echo "<td align=center> $pirep->flighttime </td>"; echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>"; echo "<td align=center> $pirep->landingrate </td>"; echo "<td align=center> $pirep->aircraft </td>"; echo "</tr>"; } } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> </tbody></table> Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted April 29, 2011 Moderators Report Share Posted April 29, 2011 That top line where you have the image wanting to be displayed add a <td> at the front and </td> at the end same as your other rows. echo '<td align=center><img src="'.fileurl('/images/airline/'.$airline->icao.'.gif').'" alt="'.$airline->name.'" /></td>'; Give that a go see how you get on. 3rd time lucky Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 30, 2011 Author Report Share Posted April 30, 2011 That worked, but still no image is showing up , it is just blank. The images are located in the following folder: http://www.mysite.com/images/airline/ so if the flight is Air Canada, the image would be www.mysite.com/images/airline/AC.gif Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted April 30, 2011 Moderators Report Share Posted April 30, 2011 When you right click on the image that isnt there, whats the url, you can normally rectify what is happening when you can see where its looking to get it from. 1 Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 30, 2011 Author Report Share Posted April 30, 2011 This is looking at the page source: <td align=center><img src="www.mysite.net/images/airline/.gif" alt="" /></td> the .gif is showing in the return, just not the image name itself Quote Link to comment Share on other sites More sharing options...
Jeff Posted April 30, 2011 Author Report Share Posted April 30, 2011 if I was to add the 2 digit code just before the .gif in that link as I pasted that link in (say B6 for JetBlue) the image shows in the browser, but somehow it isn't working on the table. here's the link to the sites airline image http://www.virtualflightzone.net/images/airline/B6.gif Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 1, 2011 Author Report Share Posted May 1, 2011 Does anyone else show airline images like this on their VA? If so, can you please give me a hand here, I can't seem to figure out what I have to do to get it to show. I have tried different configurations with no positive results. The page is here Quote Link to comment Share on other sites More sharing options...
FiveStar Posted May 1, 2011 Report Share Posted May 1, 2011 (edited) hey jeff good day to you i have visited on the given link but there also i cannot see any image on the table but any way i have sorted out how it will work this code you will be needed to show an airline image or your web logo>>>>> <h2>Recent Completed Flights Board</h2> <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table id="tabledlist" class="tablesorter" width="100%"> <thead> <tr> <th height="20" width="15%"><div align="center">Flt/Number</th></div> <th height="20" width="13%"><div align="center">Departure</th></div> <th height="20" width="13%"><div align="center">Arrival</th></div> <th height="20" width="20%"><div align="center">Aircraft</th></div> <th height="20" width="15%"><div align="center">Flight Time</th></div> <th height="20" width="12%"><div align="center">Pilot Name</th></div> <th height="20" width="12%"><div align="center">Landing Rate</th></div> <th height="20" width="15%"><div align="center">Airline</th></div> </tr> </thead> <tbody> <?php foreach($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); ?> <tr bgcolor="#D0F5A9"> <td align="center"> <a href="<?php echo url('/pireps/view/'.$pirep->pirepid);?>"><?php echo $pirep->code . $pirep->flightnum; ?></a> </td> <td height="25" width="15%" align="center"><span><?php echo $pirep->depicao; ?></td></span> <td height="25" width="13%" align="center"><span><?php echo $pirep->arricao; ?></td></span> <td height="25" width="13%" align="center"><span><?php echo $pirep->aircraft . " ($pirep->registration)"; ?></td></span> <td height="25" width="13%"align="center"><span><?php echo $pirep->flighttime; ?></td></span> <td height="25" width="13%" align="center"><span><?php echo $pilotinfo->firstname . ' ' . $pilotinfo->lastname; ?></td></span> <td height="20" width="10%" align="center"><span><?php echo $pirep->landingrate; ?></td></span> <td align="center"> <?php if($pirep->accepted == PIREP_ACCEPTED){ echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/YOUR IMAGE" border="0" alt=""/>'; } elseif($pirep->accepted == PIREP_REJECTED) echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/YOUR IMAGE" border="0" alt=""/>'; elseif($pirep->accepted == PIREP_PENDING) echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/YOUR IMAGE" border="0" alt=""/>'; elseif($pirep->accepted == PIREP_INPROGRESS) echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/YOUR IMAGE" border="0" alt=""/>'; ?> </td> </tr> <?php } ?> </tbody> </table> and please remember to put images in your current skin images directoy http://sitename.com/lib/SKIN/images/Image NAME i hope it works for you the same code is working for me..... Edited May 1, 2011 by Asmara Kamran Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 1, 2011 Author Report Share Posted May 1, 2011 I had just got it to work 3 minutes ago with the previous code that Mark posted early today, I just changed ('/images/airline/'.$airline->code.'.gif') to ('/images/airline/'.$pirep->code.'.gif') and it worked. Thanks anyways Asmara. Quote Link to comment Share on other sites More sharing options...
eitan Posted June 21, 2011 Report Share Posted June 21, 2011 This one is getting pretty difficult for me to understand. I am wanting to have a table to show on my site that displays the airline logo instead of the airline name in it. I have the airline logos named as the 2 digit IATA code the same way my airlines are named as well (ex: Southwest= WN, Delta= DL)and they are all .gif images. Is there an easy way to pull this off? hey i have for a long time collection with airline icons. can u please send me your collection? thanks a lot eitan eitanp@alphacsp.com Quote Link to comment Share on other sites More sharing options...
Jeff Posted June 23, 2011 Author Report Share Posted June 23, 2011 You can get all the logos you want by visiting this website... Airline Logos.net Quote Link to comment Share on other sites More sharing options...
jamyboy Posted December 15, 2011 Report Share Posted December 15, 2011 good day jeff i have been searching through the forum for the same code to show the airline logo image in recent completed flight table can you please post your working complete code so i can also take advantage of it i have tried the above code but its giving syntax unexpected error so please guide me through the process will be very thankful to you. Regards Jamy Quote Link to comment Share on other sites More sharing options...
Jeff Posted December 15, 2011 Author Report Share Posted December 15, 2011 <h3><font color="#003399">Latest Arrivals</font></h3> <div class="body"> <div class="news_box"> <?php $flights = PIREPData::getRecentReportsByCount(10); $string = ""; foreach($flights as $flight) { $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+'; } ?> <table width="100%"> <tr> <td><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=700x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /></td> </tr> </table> <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> </div> <?php $count = 10; $pireps = PIREPData::getRecentReportsByCount($count); ?> <table width="100%" cellpadding="1" cellspacing="0"> <thead> <tr bgcolor="#003399"> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Pilot</font></th> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Airline</font></th> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Flight #</font></th> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Origin</font></th> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Arrival</font></th> <th align="center"> <font face='Verdana' size='2' color="#FFFFFF">Landing Rate</font></th> </tr> </thead> <tbody> <?php if(count($pireps) > 0) { foreach ($pireps as $pirep) { $pilotinfo = PilotData::getPilotData($pirep->pilotid); $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); echo "<tr>"; echo "<td align=center> <font face=Verdana size=2 color=#003399> $pirep->firstname $pirep->lastname</font></td>"; echo '<td align=center width=120px bgcolor=#FFFFFF><a href="'.fileurl('/index.php/pireps/viewreport/'.$pirep->pirepid.'').'" target="_blank"><img src="'.fileurl('/images/airline/'.$pirep->code.'.gif').'" alt="'.$airline->name.'" width="127px" height="32px" /></a></td>'; echo "<td align=center> <font face=Verdana size=2 color=#003399>$pirep->code $pirep->flightnum </a></font></td>"; echo "<td align=center> <font face=Verdana size=2 color=#003399> $pirep->depicao </font></td>"; echo "<td align=center> <font face=Verdana size=2 color=#003399> $pirep->arricao </font></td>"; echo "<td align=center> <font face=Verdana size=2 color=#003399> $pirep->landingrate ft/min</font></td>"; echo "</tr>"; } } else { echo "<tr><td>There are no recent flights!</td></tr>"; } ?> </tbody> </table> </div></div> 3 Quote Link to comment Share on other sites More sharing options...
jamyboy Posted December 15, 2011 Report Share Posted December 15, 2011 Thanks Jeff you rocks man +1 for you Quote Link to comment Share on other sites More sharing options...
ARV187 Posted June 16, 2013 Report Share Posted June 16, 2013 What is the code to make the same but in live flight table? P.D: may be this? <td align="center" bgcolor="#FFFF00"><strong><?php echo $flight->flightnum;?></td> if($airline->icao == "AIRLINE CODE") { echo "<img style='padding-left:3px;' src='URL_IMAGE.gif'>"; } 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.