Jump to content

Recommended Posts

Posted

I am trying to copy some code from top pilots module, put into my frontpage_main.php. When I do this I get this message.

leaderboard.png

I have flights already this month, the mod pages shows that aswell.

Here is the code take from the modules template file. Am I missing something? Any idea why its not showing the flights?

  <div class="group">
        <div class="col span_1_of_2">
            <h3>Hours Flown</h3>
            <table>
                <thead>
                <tr>
                    <th>
                        Member
                    </th>
                    <th style="text-align: right;">
                        Hours
                    </th>
                </tr>
                </thead>
                <tbody>
                <?php
                $all_hours = TopPilotData::top_pilot_hours($today[mon], $today[year], 5); ?>
                <?php if (!$all_hours): ?>
                    <tr><td colspan="2">Get a head start on this month's leaderboard by flying today!</td></tr>
                <?php else:
                foreach($all_hours as $entry):
                    $pilot = PilotData::GetPilotData($entry->pilot_id); ?>
                <tr>
                    <td>
                        <strong>
                            <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></strong>
                        <img src="<?php echo Countries::getCountryImage($pilot->location);?>"
                             alt="<?php echo Countries::getCountryName($pilot->location);?>" style="padding-right: 10px; position: relative; top: 1px;"/><br/>
                        <a href="<?php echo url('profile/view/'.$pilot->pilotid); ?>">
                            <?php echo $pilot->firstname.' '.$pilot->lastname?></a>
                    </td>
                    <td style="text-align: right;">
                        <?php echo str_replace(".", ":", number_format($entry->hours, 2)); ?>
                    </td>
                </tr>
                    <?php endforeach; endif; ?>
                </tbody>
            </table>
        </div>

 

  • 2 weeks later...
Posted

What do you put in the variables $today[mon] and $today[year] ? You've got to make sure they contain the right values. You might test the script by just putting numbers in there like 10 and 2017 and see what it does.

is this a freeware module?

  • Thanks 1

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