Moderators mark1million Posted October 15, 2011 Moderators Report Share Posted October 15, 2011 I have just been looking at how the pirep log is displayed, <?php # Simple, each line of the log ends with * # Just explode and loop. $log = explode('*', $pirep->log); foreach($log as $line) { echo $line .'<br />'; } ?> If it possible to style based on an event, for example If the log contains Stall format that text in Red Bold for example, or if it contains a landing rate < -500 that is also formatted, im just trying to get some ideas on how to format the output based on different events and even if it is possible. Thanks. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted October 17, 2011 Author Moderators Report Share Posted October 17, 2011 A kind bump please Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted October 17, 2011 Administrators Report Share Posted October 17, 2011 You could do some conditional statements, it would probably get a little lengthy in order to cover everything and every type of ACARS system but maybe something like this for the TOD event; [22:54] - TOD reached <?php # Simple, each line of the log ends with * # Just explode and loop. $log = explode('*', $pirep->log); foreach($log as $line) { $line_items = explode('-', $line); { if($line_items['1'] == 'TOD reached') {echo '<font color="#00FF00">'.$line.'</font><br />';} else { echo $line .'<br />';} } } ?> Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted October 18, 2011 Author Moderators Report Share Posted October 18, 2011 Dave i have tried many permutations but no still not making any difference, just to check i changed the else to another colour just to make sure it would and that's fine. Just seems to be the conditions its not picking up. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted October 21, 2011 Author Moderators Report Share Posted October 21, 2011 I dont mean to harp on about this but has anyone else tried, I cant get the if statement to change the display colour, just wondered if any one else has managed to get it to work? Cheers. Quote Link to comment Share on other sites More sharing options...
freshJet Posted October 21, 2011 Report Share Posted October 21, 2011 I'm considering it - but I don't really want my pilots stalling anyway Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted October 21, 2011 Author Moderators Report Share Posted October 21, 2011 Thats not really the point of it, the point is if they do stall or something else happens thats not supposed to i want to be able to highlight it in the log so it jumps out at you. Quote Link to comment Share on other sites More sharing options...
freshJet Posted October 21, 2011 Report Share Posted October 21, 2011 Yeah I know but still... Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted October 21, 2011 Administrators Report Share Posted October 21, 2011 I just tried it on my site and had to change; explode('-', $line) to explode(' - ', $line) and it works. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted October 21, 2011 Author Moderators Report Share Posted October 21, 2011 You know what i tried everything apart from that....... typical, Many thanks Dave. Quote Link to comment Share on other sites More sharing options...
mattia Posted November 22, 2011 Report Share Posted November 22, 2011 delete Quote Link to comment Share on other sites More sharing options...
mattia Posted April 1, 2013 Report Share Posted April 1, 2013 In kaCARS free dont work because in the kacars free log not have the - in the log [14:45] TOD Reached what is the code for the log kacars free? I tried this but does not work <?php # Simple, each line of the log ends with * # Just explode and loop. $log = explode('*', $pirep->log); foreach($log as $line) { $line_items = explode(' ', $line); { if($line_items['1'] == 'TOD reached') {echo '<font color="#00FF00">'.$line.'</font><br />';} else { echo $line .'<br />';} } } ?> 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.