saapilot Posted March 14, 2010 Report Posted March 14, 2010 Good day, I'm trying to display current bids, in table format, in the main body of the front page without much luck. The problem is that no data is displayed even though there are bids, there are also no error messages displayed. Any help would be greatly appreciated. <div id="mainbox"><h3>Flight Departures Board</h3> <table width="100%" class="tablesorter"> <thead> <tr bgcolor="#336699"> <th height="25" width="10%"><div align="center">Flight Number</div></th> <th height="25" width="10%"><div align="center">Pilot ID</div></th> <th height="25" width="30%"><div align="center">Aircraft Type</div></th> <th height="25" width="10%"><div align="center">Tail No.</div></th> <th height="25" width="15%"><div align="center">Depart Airport</th> <th height="25" width="15%"><div align="center">Arrive Airport</div></th> <th height="25" width="10%"><div align="center">Flight Time</div></th> </tr> </thead> <tbody> <?php if(!$bids) { echo 'No flights have currently been booked'; return; } foreach($bids as $bid); { ?> <tr bgcolor="#DFF4FF"> <td height="25" width="10%" align="center"><?php echo $bid->code . $bid->flightnum; ?></a> </td> <?php $params = $bid->pilotid; $pilot = PilotData::GetPilotData($params); $pname = $pilot->firstname; $psurname = $pilot->lastname; ?> <td height="25" width="10%" align="center"><span><?php echo $pname; ?> <?php echo $psurname; ?></span></td> <td height="25" width="30%" align="center"><span><?php echo $bid->aircraft; ?></span></td> <td height="25" width="10%" align="center"><?php echo $bid->registration?></td> <td height="25" width="15%" align="center"><span><?php echo $bid->depicao; ?></span></td> <td height="25" width="15%" align="center"><span><?php echo $bid->arricao; ?></span></td> <td height="25" width="10%" align="center"><span><?php echo $bid->flighttime; ?> Hours</span></td> </tr> <?php } ?> </tbody> </table> <hr> </div> Many thanks Mark Quote
Administrators Nabeel Posted March 15, 2010 Administrators Report Posted March 15, 2010 You have a semi-colon at the end of hte foreach: foreach($bids as $bid); That could be it. Quote
saapilot Posted March 15, 2010 Author Report Posted March 15, 2010 Thanks Nabeel, That worked, I also had to change the reference from "bid" to "lastbid" Mark Quote
Moderators mark1million Posted March 15, 2010 Moderators Report Posted March 15, 2010 Could you post the working code? Maybe then the mods could move this little gem to code snippets Quote
saapilot Posted March 15, 2010 Author Report Posted March 15, 2010 Here's the working code, to go into frontpage_recentbids.tpl <div id="mainbox"> <h3>Flight Departures Board</h3> <?php if(!$lastbids) { echo '<p align="center">No flights have currently been booked</p>'; return; } ?> <table width="100%" class="tablesorter"> <thead> <tr bgcolor="#336699"> <th height="25" width="15%"><div align="center">Flight Number</div></th> <th height="25" width="13%"><div align="center">Depart</div></th> <th height="25" width="13%"><div align="center">Arrive</div></th> <th height="25" width="20%"><div align="center">Pilot Name</div></th> <th height="25" width="15%"><div align="center">Aircraft</th> <th height="25" width="12%"><div align="center">Tail No.</div></th> <th height="25" width="12%"><div align="center">Flight Time</div></th> </tr> </thead> <tbody> <?php foreach($lastbids as $lastbid) { ?> <tr bgcolor="#DFF4FF"> <td height="25" width="15%" align="center"><?php echo $lastbid->code . $lastbid->flightnum; ?></a> </td> <td height="25" width="13%" align="center"><span><?php echo $lastbid->depicao; ?></span></td> <td height="25" width="13%" align="center"><span><?php echo $lastbid->arricao; ?></span></td> <?php $params = $lastbid->pilotid; $pilot = PilotData::GetPilotData($params); $pname = $pilot->firstname; $psurname = $pilot->lastname; ?> <td height="25" width="20%" align="center"><span><?php echo $pname; ?> <?php echo $psurname; ?></span></td> <td height="25" width="15%" align="center"><span><?php echo $lastbid->aircraft; ?></span></td> <td height="25" width="12%" align="center"><?php echo $lastbid->registration?></td> <td height="25" width="12%" align="center"><span><?php echo $lastbid->flighttime; ?> Hours</span></td> </tr> <?php } ?> </tbody> </table> <hr> </div> Add the following to frontpage_main.tpl MainController::Run('FrontBids', 'RecentFrontPage', 5); Quote
Matthew Talbot Posted June 2, 2010 Report Posted June 2, 2010 is this for use with Obsess Blue, I prefer crystal as when I just tested out the code, I could only see half of the recent bids on the home page Many Thanks, Matthew Quote
dale0404 Posted June 2, 2010 Report Posted June 2, 2010 is this for use with Obsess Blue, I prefer crystal as when I just tested out the code, I could only see half of the recent bids on the home page Many Thanks, Matthew Do you mean you only see half the table horizontally? If so then change the following: <table width="100%" class="tablesorter"> to <table width="700" class="tablesorter"> Quote
Matthew Talbot Posted June 4, 2010 Report Posted June 4, 2010 Thanks Works a treat! Thats my word Quote
Matthew Talbot Posted June 4, 2010 Report Posted June 4, 2010 It does not show up on my frontpage all that appears is MainController::Run('FrontBids', 'RecentFrontPage', 5); Quote
Administrators simpilot Posted June 5, 2010 Administrators Report Posted June 5, 2010 It does not show up on my frontpage all that appears is MainController::Run('FrontBids', 'RecentFrontPage', 5); It probably needs to be wrapped in php tags <?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?> Quote
Harryh Posted June 27, 2010 Report Posted June 27, 2010 Hey im using this code and ive Added some Bids and i still get the same message "No flights have currently been booked" Please Help this page can be located http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights Quote
Jeff Posted July 1, 2010 Report Posted July 1, 2010 Hey im using this code and ive Added some Bids and i still get the same message "No flights have currently been booked" Please Help this page can be located http://jet-magic.co.uk/phpvms/index.php/pages/bookedflights Harry, this is everything I have done to get it to show up on my main page. this is the whole code in /home/yoursite/public_html/core/templates/frontpage_recentbids.tpl <div id="mainbox"> <h3><img src="http://www.oneworldvs.net/lib/images/icons/flights.jpg">Flight Departures Board</h3> <?php if(!$lastbids) { echo '<p align="center">No flights have currently been booked</p>'; return; } ?> <table width="100%" border="1" bordercolor="#FFFFFF" class="tablesorter" id="tabledlist"> <thead> <tr align="center" valign="middle" bgcolor="#0079B2"> <th height="25" width="15%"><div align="center">Flight Number</div></th> <th height="25" width="13%"><div align="center">Depart</div></th> <th height="25" width="13%"><div align="center">Arrive</div></th> <th height="25" width="20%"><div align="center">Pilot Name</div></th> <th height="25" width="15%"><div align="center">Aircraft</th> <th height="25" width="12%"><div align="center">Tail No.</div></th> <th height="25" width="12%"><div align="center">Flight Time</div></th> </tr> </thead> <tbody> <?php foreach($lastbids as $lastbid) { ?> <tr align="center" valign="middle" bgcolor="#DFF4FF"> <td height="25" width="15%" align="center"><?php echo $lastbid->code . $lastbid->flightnum; ?></a> </td> <td height="25" width="13%" align="center"><span><?php echo $lastbid->depicao; ?></span></td> <td height="25" width="13%" align="center"><span><?php echo $lastbid->arricao; ?></span></td> <?php $params = $lastbid->pilotid; $pilot = PilotData::GetPilotData($params); $pname = $pilot->firstname; $psurname = $pilot->lastname; ?> <td height="25" width="20%" align="center"><span><?php echo $pname; ?> <?php echo $psurname; ?></span></td> <td height="25" width="15%" align="center"><span><?php echo $lastbid->aircraft; ?></span></td> <td height="25" width="12%" align="center"><?php echo $lastbid->registration?></td> <td height="25" width="12%" align="center"><span><?php echo $lastbid->flighttime; ?> Hours</span></td> </tr> <?php } ?> </tbody> </table> <hr> </div> Now, in the page you want it to show, place this code: <?php MainController::Run('FrontBids', 'RecentFrontPage', 5); ?> The number 5 can be changed to any number to show how many bids you want to show at one time. Quote
Harryh Posted July 11, 2010 Report Posted July 11, 2010 Hey Thank you soo much working perfectly now (: 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.