Jump to content

Airline logos on flights completed [SOLVED]


Jeff

Recommended Posts

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>

Link to comment
Share on other sites

  • Administrators

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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. :(

Link to comment
Share on other sites

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>

post-604-057978700 1304112839_thumb.jpg

Link to comment
Share on other sites

  • Moderators

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 ;)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by Asmara Kamran
Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 5 months later...

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

Link to comment
Share on other sites

            	<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>

  • Like 3
Link to comment
Share on other sites

  • 1 year later...

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'>"; }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...