Jump to content

Current Bids (On frontpage)


saapilot

Recommended Posts

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

Link to comment
Share on other sites

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);
Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

  • Administrators

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

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
Share on other sites

  • 2 weeks later...

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