freshJet Posted March 25, 2012 Report Share Posted March 25, 2012 I want to make a foreach loop with the schedule route and the nav data, so basically display the data for each waypoint in the route. I noticed there is a function called parseRoute($schedule), which I tried to implement by nothing happened. Any ideas??? Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 26, 2012 Author Report Share Posted March 26, 2012 Or can anyone tell me how to use the parseRoute() function? Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted March 26, 2012 Moderators Report Share Posted March 26, 2012 I been trying to chase that, but I'm still no expert yet. But I'll try again and see what I can make out of it. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted March 26, 2012 Moderators Report Share Posted March 26, 2012 Here's what I have so far. No luck... Hopefully someone with a knowledge of it will come by. <?php $fromlat = $schedule->deplat; $fromlng = $schedule->deplng; $route_string = $schedule->route; $routedata = NavData::parseRoute($fromlat, $fromlng, $route_string); $route_string = array(); ?> <table> <thead> <tr> <th>Lat</th> <th>Long</th> </tr> </thead> <tbody> <?php foreach($routedata as $routeline) { ?> <tr> <td align="center"><?php echo $routeline->lat; ?></td> <td align="center"><?php echo $routeline->lng; ?></td> </tr> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 26, 2012 Author Report Share Posted March 26, 2012 Yeah that's similar to my code. There's a description in the code but I don't get it. Nabeel? Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 28, 2012 Author Report Share Posted March 28, 2012 Thought someone would've come up with the solution by now Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 28, 2012 Report Share Posted March 28, 2012 Here you go <?php $params->deplat = 1; $params->deplng = 1; $params->route = 'HEL UT6 PEVEN UL990 PERRY'; $routedata = NavData::parseRoute($params); ?> <table> <thead> <tr> <th>Lat</th> <th>Long</th> </tr> </thead> <tbody> <?php foreach($routedata as $routeline) { ?> <tr> <td align="center"><?php echo $routeline->lat; ?></td> <td align="center"><?php echo $routeline->lng; ?></td> </tr> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 28, 2012 Author Report Share Posted March 28, 2012 Still not working for me :/ Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 28, 2012 Report Share Posted March 28, 2012 do you have the navdata table installed? Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 29, 2012 Author Report Share Posted March 29, 2012 Yes. I mentioned it in the first post. Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 29, 2012 Author Report Share Posted March 29, 2012 And I'm trying to get waypoint name etc like it says in Navdata.class.php Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 29, 2012 Report Share Posted March 29, 2012 So I am confused? Is the loop working at all? It is one my site. If you want the name then just expand the table. The table that Kyle wrote has just the lat/lng but all columns can be put into the table. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted March 29, 2012 Moderators Report Share Posted March 29, 2012 Still not working for me :/ It worked for me. Did you change code on top and set it where your getting the data. $params->deplat = 1; $params->deplng = 1; $params->route = 'HEL UT6 PEVEN UL990 PERRY'; So, if your doing it in the schedules detail page, this is the code.. <?php $params->deplat = $schedule->deplat; $params->deplng = $schedule->deplng; $params->route = $schedule->route; $routedata = NavData::parseRoute($params); ?> <table> <thead> <tr> <th>Lat</th> <th>Long</th> </tr> </thead> <tbody> <?php foreach($routedata as $routeline) { ?> <tr> <td align="center"><?php echo $routeline->lat; ?></td> <td align="center"><?php echo $routeline->lng; ?></td> </tr> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 29, 2012 Author Report Share Posted March 29, 2012 Nope not working: <?php $params->deplat = $schedule->deplat; $params->deplng = $schedule->deplng; $params->route = $route; $routedata = NavData::parseRoute($params); ?> <table> <thead> <tr> <th>Lat</th> <th>Long</th> </tr> </thead> <tbody> <?php foreach($routedata as $routeline) { ?> <tr> <td align="center"><?php echo $routeline->lat; ?></td> <td align="center"><?php echo $routeline->lng; ?></td> </tr> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 29, 2012 Author Report Share Posted March 29, 2012 Just to confirm this will lead to what I'm looking for won't it? Displaying the data for each waypoint? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 29, 2012 Report Share Posted March 29, 2012 How are you filling the $schedule array and the $route variable? Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 30, 2012 Author Report Share Posted March 30, 2012 By the way this is in a file called briefing.php in my public_html directory. Schedule: $schedule = SchedulesData::GetScheduleDetailed (all I can remember off the top of my head) $route is $schedule->route but with some characters removed as some of my routes had '?' instead of a space so I used str_replace to do replace that with a space. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 30, 2012 Report Share Posted March 30, 2012 Then change this $params->deplat = $schedule->deplat; $params->deplng = $schedule->deplng; $params->route = $route; to this $params->deplat = $schedule->deplat; $params->deplng = $schedule->deplng; $params->route = $schedule->route; And then expand the table to show what you wish. The route must be part of the schedule for this to work Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 30, 2012 Author Report Share Posted March 30, 2012 Still doesn't work. It just displays the headers lat and long. Where does $params lead to? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 30, 2012 Report Share Posted March 30, 2012 Send me the complete code from the page you are attempting to use this in. PM it. Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 30, 2012 Author Report Share Posted March 30, 2012 Well if it's any use I tried the exact code you had and put it in the flight briefings and still nothing Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted April 2, 2012 Report Share Posted April 2, 2012 If you use this <?php $params->deplat = 1; $params->deplng = 1; $params->route = 'HEL UT6 PEVEN UL990 PERRY'; $routedata = NavData::parseRoute($params); ?> <table> <thead> <tr> <th>Lat</th> <th>Long</th> </tr> </thead> <tbody> <?php foreach($routedata as $routeline) { ?> <tr> <td align="center"><?php echo $routeline->lat; ?></td> <td align="center"><?php echo $routeline->lng; ?></td> </tr> <?php } ?> </tbody> </table> And nothing shows up then there is something wrong. This supplies the start lat/lng and the route. I would check your DB and ensure that the navdata table is there. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted April 3, 2012 Moderators Report Share Posted April 3, 2012 From what itrobb is saying, I agree and it doesn't look like he has or not have the navdata tables set up or not correct. Do you have a table like navdata or phpvms_navdata in your database? Double check and if it is empty or not there, then you would need to import one from the latest phpVMS Version. Quote Link to comment Share on other sites More sharing options...
freshJet Posted April 3, 2012 Author Report Share Posted April 3, 2012 Yup I've checked and checked again. Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 21, 2012 Author Report Share Posted May 21, 2012 Erm sorry to bring this up but just checked my navdata and it is indeed empty :S How do I populate it? Quote Link to comment Share on other sites More sharing options...
freshJet Posted May 21, 2012 Author Report Share Posted May 21, 2012 OK it works and I now have the lat and long for each waypoint, but how can I retrieve the rest of the data for each waypoint (type, freq etc) by using the coordinates? Quote Link to comment Share on other sites More sharing options...
freshJet Posted June 4, 2012 Author Report Share Posted June 4, 2012 bump 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.