Jeff Posted March 31, 2011 Report Share Posted March 31, 2011 I'm trying to create a table in the pilot_public_profile.tpl that will show the Aircraft Usage Statistics of every aircraft type that the pilot uses, so I can award them with an aircraft typerating award. I am not sure if I am anywhere close to getting it to work, as I keep getting this error... Parse error: syntax error, unexpected T_CLASS in /home/virtualf/public_html/core/templates/pilot_public_profile.tpl on line 120 <p> <h3><?php echo $userinfo->firstname; ?>'s Aircraft Statistics</br></h3> <table width="100%" border="1" bgcolor="#042233" id="tabledlist" class="tablesorter"> <thead> <tr> <th><font color="F78F1E">Aircraft</font></th> <th><font color="F78F1E">Times Flown</font></th> <th><font color="F78F1E">Hours Flown</font></th> </tr> </thead> <?php echo StatsData.class.php::PilotAircraftFlownCounts($pilotid) //This is Line 120...... echo '<tr><td align = "center">'.$aircraft->icao.'</td> <td align = "center">'.$aircraft->totalflights.'</td> <td align = "center">'.$aircraft->totalhours.'</td></tr>'; ?> </p> <p> </p> Quote Link to comment Share on other sites More sharing options...
Nuclear Posted March 31, 2011 Report Share Posted March 31, 2011 The correct usage would be: <?php echo StatsData::PilotAircraftFlownCounts($pilotid) I didn't bother to look this up though, so I don't know what it returns. Quote Link to comment Share on other sites More sharing options...
Jeff Posted March 31, 2011 Author Report Share Posted March 31, 2011 Now I get this error: Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in /home/virtualf/public_html/core/templates/pilot_public_profile.tpl on line 88 <p> <h3><?php echo $userinfo->firstname; ?>'s Aircraft Statistics</br></h3> <table width="100%" border="1" bgcolor="#042233" id="tabledlist" class="tablesorter"> <thead> <tr> <th><font color="F78F1E">Aircraft</font></th> <th><font color="F78F1E">Times Flown</font></th> <th><font color="F78F1E">Hours Flown</font></th> </tr> </thead> <?php echo StatsData::PilotAircraftFlownCounts($pilotid) echo '<tr><td align = "center">'.$aircraft->icao.'</td> //This is line 88 <td align = "center">'.$aircraft->totalflights.'</td> <td align = "center">'.$aircraft->totalhours.'</td></tr>'; ?> </p> <p> </p> So something is still not coded correctly on there. I'm stuck. Quote Link to comment Share on other sites More sharing options...
Nuclear Posted March 31, 2011 Report Share Posted March 31, 2011 Forgot the semicolon at the end. Should be: <?php echo StatsData::PilotAircraftFlownCounts($pilotid); Quote Link to comment Share on other sites More sharing options...
Jeff Posted March 31, 2011 Author Report Share Posted March 31, 2011 Okay, it is displaying, but nothing is showing up where the aircraft information is supposed to be showing. It is showing the text: Aircraft, Times Flown, Hours Flown, but under those it is just blank. What coding is needed to make that information display. i know those pilots have flown before because it is showing in their profile, but just not in that chart I am creating. Quote Link to comment Share on other sites More sharing options...
Nuclear Posted March 31, 2011 Report Share Posted March 31, 2011 I've never used this before and the documentation doesn't really explain it, but I screwed around with it and found out this: StatsData::PilotAircraftFlownCounts returns an array of aircraft,counts and hours for the given PilotID (I don't know what else it returns). So, you'll need to loop through the array and echo the results, something like this: $stats=StatsData::PilotAircraftFlownCounts($pilotid); foreach($stats as $stat) { echo $stat->aircraft.' '.$stat->count.' '.$stat->hours.'<br>'; } Obviously, you want to put the data in your table, but this is an example. Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 21, 2014 Report Share Posted October 21, 2014 Hey, i am trying the same thing, but Nuclear's code dont't work in my pilot:public_profile... It's just emptry. Also Jeff's code produce empty tables. Are there any news or a code that works? Thanks 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.