flyalaska Posted September 30, 2017 Report Posted September 30, 2017 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. 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> Quote
mischka Posted October 11, 2017 Report Posted October 11, 2017 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? 1 Quote
Moderators servetas Posted October 11, 2017 Moderators Report Posted October 11, 2017 Before: $all_hours = TopPilotData::top_pilot_hours($today[mon], $today[year], 5); add this: $today = getdate(); As @mischka stated, $today variable is not populated correctly. 1 Quote
flyalaska Posted October 11, 2017 Author Report Posted October 11, 2017 Thank you both, got it working 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.