freshJet Posted March 25, 2012 Report 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
freshJet Posted March 26, 2012 Author Report Posted March 26, 2012 Or can anyone tell me how to use the parseRoute() function? Quote
Moderators Kyle Posted March 26, 2012 Moderators Report 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
Moderators Kyle Posted March 26, 2012 Moderators Report 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
freshJet Posted March 26, 2012 Author Report 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
freshJet Posted March 28, 2012 Author Report Posted March 28, 2012 Thought someone would've come up with the solution by now Quote
Guest lorathon Posted March 28, 2012 Report 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
Guest lorathon Posted March 28, 2012 Report Posted March 28, 2012 do you have the navdata table installed? Quote
freshJet Posted March 29, 2012 Author Report Posted March 29, 2012 Yes. I mentioned it in the first post. Quote
freshJet Posted March 29, 2012 Author Report Posted March 29, 2012 And I'm trying to get waypoint name etc like it says in Navdata.class.php Quote
Guest lorathon Posted March 29, 2012 Report 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
Moderators Kyle Posted March 29, 2012 Moderators Report 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
freshJet Posted March 29, 2012 Author Report 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
freshJet Posted March 29, 2012 Author Report 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
Guest lorathon Posted March 29, 2012 Report Posted March 29, 2012 How are you filling the $schedule array and the $route variable? Quote
freshJet Posted March 30, 2012 Author Report 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
Guest lorathon Posted March 30, 2012 Report 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
freshJet Posted March 30, 2012 Author Report Posted March 30, 2012 Still doesn't work. It just displays the headers lat and long. Where does $params lead to? Quote
Guest lorathon Posted March 30, 2012 Report Posted March 30, 2012 Send me the complete code from the page you are attempting to use this in. PM it. Quote
freshJet Posted March 30, 2012 Author Report 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
Guest lorathon Posted April 2, 2012 Report 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
Moderators Kyle Posted April 3, 2012 Moderators Report 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
freshJet Posted April 3, 2012 Author Report Posted April 3, 2012 Yup I've checked and checked again. Quote
freshJet Posted May 21, 2012 Author Report 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
freshJet Posted May 21, 2012 Author Report 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
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.