Fernando Posted October 5, 2012 Report Share Posted October 5, 2012 I searched here in the forum something like Booked Flights, thought, but nothing worked properly. I visualized the Admin Center, my pilots booked 18 flights, but not me this script returns the same flights on the Frontpage_main.tpl,. Someone has something similar like this http://airmaltavirtu...ex.php/bookings The script I have is this, but he did not return the you that I see in the admin center. Current Booked Flights</h3> <?php /*echo '<pre>'; print_r($allbids); echo '</pre>';*/ if(!$allbids) { echo 'There are no bids!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Route</th> <th>Pilot</th> <th>Day Filed</th> <th>Options</th> </tr> </thead> <tbody> <?php foreach($allbids as $bid) {?> <tr id="row<?php echo $bid->bidid?>"> <td><?php echo $bid->code.$bid->flightnum."({$bid->depicao} - {$bid->arricao})"?></td> <td><?php echo PilotData::GetPilotCode($bid->code, $bid->flightnum).' - '.$bid->firstname.' '.$bid->lastname; ?></td> <td><?php echo $bid->dateadded; ?></td> <td> <button href="<?php echo url('/schedules/brief/'.$bid->routeid);?>"> Brief</button> </td> </tr> <?php } ?> </tbody> </table> Commercial Pilot www.voegolv.net Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 6, 2012 Moderators Report Share Posted October 6, 2012 I would do this in the following order. First, place this in your front page: <?php MainController::Run('FrontBids', 'RecentFrontPage', 10); ?> Secondly, go to frontpage_recentbids.tpl and put what you want to show there. Below is the default code in there: <?php if(!$lastbids) { echo 'No bids have been made'; return; } foreach($lastbids as $lastbid); { ?> <style type="text/css"> <!-- .style2 { font-family: Arial; font-size: 10px; } --> </style> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td><p class="style2"><?php echo $lastbid->bidid . ' - ' . $lastbid->code.$lastbid->flightnum.' - '.$lastbid->depicao.' to '.$lastbid->arricao?></a> </p> <?php } ?></p></td> </tr> </table> Remember you can put any number instead of 10 in the first code and that's the number of rows it will return. Quote Link to comment Share on other sites More sharing options...
Fernando Posted October 6, 2012 Author Report Share Posted October 6, 2012 It worked, How can I insert a table with the following data Flight number Pilot Departure Arrival Aircraft Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 6, 2012 Moderators Report Share Posted October 6, 2012 Replace the entire code in frontpage_recentbids.tpl with the following: <?php if(!$lastbids) { echo 'No bids have been made'; return; } foreach($lastbids as $lastbid); { ?> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td>Flight #</td> <td>Pilot</td> <td>Departure</td> <td>Arrival</td> <td>Aircraft</td> </tr> <tr> <td><?php echo $lastbid->code.$lastbid->flightnum ;?></td> <td> <?php $pilotid = $lastbid->pilotid; $pilot = PilotData::getPilotData($pilotid); echo $pilot->firstname.' '.$pilot->lastname ;?> </td> <td><?php echo $lastbid->depicao ;?></td> <td><?php echo $lastbid->arricao ;?></td> <td><?php echo $lastbid->aircraft ;?></td> </tr> </table> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Fernando Posted October 6, 2012 Author Report Share Posted October 6, 2012 Parkho Good Work. Thank you very much for help. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 6, 2012 Moderators Report Share Posted October 6, 2012 yw Quote Link to comment Share on other sites More sharing options...
loplo Posted December 2, 2012 Report Share Posted December 2, 2012 For me, applying the script from above, it's showing only one bid, and not all of them. Quote Link to comment Share on other sites More sharing options...
stelioc Posted December 4, 2012 Report Share Posted December 4, 2012 For me, applying the script from above, it's showing only one bid, and not all of them. me too any help so we can have 5 lines at least please? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted December 6, 2012 Administrators Report Share Posted December 6, 2012 Are you setting the number of records to return as parkho indicates in the first post? <?php MainController::Run('FrontBids', 'RecentFrontPage', 10); ?> The '10' is how many to return. You also could move the foreach loop further down in the code to not include the title row for every record and just include the body of the table in the loop. Quote Link to comment Share on other sites More sharing options...
loplo Posted December 6, 2012 Report Share Posted December 6, 2012 My code is <?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?> Regarding the position of the foreach, I'm not sure that I'm able to do that. Lack of knowledge. 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.