Jump to content

Recommended Posts

Posted

It occurs to me that php VMS provides a page to publicly list pilots and hubs, but none to list the fleet. I think that might be a nice feature. You know, ICAO code, full a/c name , tail number, and an option for a graphic.

Until that happens, does anyone care to share an example of such a page. At my age, I'm too old a dog to learn new tricks.rolleyes.gif

Posted

Thank you very much for pointing that out. I had missed it the first time I looked. The tread was entitled question and I didn't need more of those.biggrin.gif

That works very well, but I'll need to delete aircraft I don't want to display, rather than de-activate them, but that isn't a problem.

Guest lorathon
Posted

You do not need to delete the aircraft to not have the display. You can just disable them and may sure the loop continues if it sees the aircraft as diabled.

I have now looked at the code in a long time but if you stick something like this in the loop it should not display disabled aircraft.

if($aircraft->enabled == '0') continue;

I will look at the code and post a better look

Guest lorathon
Posted

Unless I modified the template the above should work. Just but it inside of the {} brackets after the foreach($fleet as $aircraft)

It should look like this


foreach($fleet as $aircraft)
{
   if($aircraft->enabled == '0') continue;

Posted

I'm not sure we are talking about the same code. This is the one I found. If there is another one I should be looking at, let me know

<?php $allaircraft = OperationsData::GetAllAircraft(); ?> 
<?php 
if(!$allaircraft) 
{ 
   	echo '<p id="error">No aircraft have been added</p>'; 
   	return; 
} 
?> 

<table border="1"> 
<thead>   
<?php //thead Is the top of the table ?> 
<tr><td><b>ICAO</b></td><td><b>Type</b></td><td><b>Registration</b></td><td><b>Range</b></td><td><b>Weight</b></td><td><b>Cruise</b></td><td><b>Max Pax</b></td><td><b>Max Cargo</b></td></tr> 
</thead> 
<tbody> 
<?php //below is all the info for each aircraft ?> 
<?php foreach ($allaircraft as $aircraft)  
{ 
?> 
<tr> 
<td><?php echo $aircraft->icao; ?> </td> 
<td><?php echo $aircraft->name; ?> </td> 
<td><?php echo $aircraft->registration; ?></td> 
<td><?php echo $aircraft->range; ?> </td> 
<td><?php echo $aircraft->weight; ?></td> 
<td><?php echo $aircraft->cruise; ?></td> 
<td><?php echo $aircraft->maxpax; ?></td> 
<td><?php echo $aircraft->maxcargo; ?></td> 
</tr> 
<?php } ?> 
</tbody> 
</table>

Guest lorathon
Posted

I'm not sure we are talking about the same code. This is the one I found. If there is another one I should be looking at, let me know

<?php $allaircraft = OperationsData::GetAllAircraft(); ?> 
<?php 
if(!$allaircraft) 
{ 
   	echo '<p id="error">No aircraft have been added</p>'; 
   	return; 
} 
?> 

<table border="1"> 
<thead>   
<?php //thead Is the top of the table ?> 
<tr><td><b>ICAO</b></td><td><b>Type</b></td><td><b>Registration</b></td><td><b>Range</b></td><td><b>Weight</b></td><td><b>Cruise</b></td><td><b>Max Pax</b></td><td><b>Max Cargo</b></td></tr> 
</thead> 
<tbody> 
<?php //below is all the info for each aircraft ?> 
<?php foreach ($allaircraft as $aircraft)  
{ 
?> 
<tr> 
<td><?php echo $aircraft->icao; ?> </td> 
<td><?php echo $aircraft->name; ?> </td> 
<td><?php echo $aircraft->registration; ?></td> 
<td><?php echo $aircraft->range; ?> </td> 
<td><?php echo $aircraft->weight; ?></td> 
<td><?php echo $aircraft->cruise; ?></td> 
<td><?php echo $aircraft->maxpax; ?></td> 
<td><?php echo $aircraft->maxcargo; ?></td> 
</tr> 
<?php } ?> 
</tbody> 
</table>

Basically the same thing

<?php foreach ($allaircraft as $aircraft)  
{ 
   if($aircraft->enabled == '0') continue;

Just add the bottom line

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