# php help

**URL:** <https://forum.phpvms.net/t/php-help/4426>\
**Category:** Code Snippets\
**Created:** [April 2, 2011, 10:35am UTC](https://forum.phpvms.net/t/php-help/4426 "2011-04-02T10:35:27Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 3, 2011, 1:42pm UTC](https://forum.phpvms.net/t/php-help/4426/21 "2011-04-03T13:42:37Z")

</div>

Where is the route information stored and how would I recall it?

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 5:02pm UTC](https://forum.phpvms.net/t/php-help/4426/22 "2011-04-03T17:02:32Z")

</div>

Routes are in your schedules if thats what you mean?

If you take a look in to the schedule\_brief.tpl you can see the code there that calls it.

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 3, 2011, 5:07pm UTC](https://forum.phpvms.net/t/php-help/4426/23 "2011-04-03T17:07:36Z")

</div>

> Routes are in your schedules if thats what you mean?
> 
> If you take a look in to the schedule\_brief.tpl you can see the code there that calls it.

Yes but i need the total distance of a flight the pilot is flying to be shown on the live flight map (Im making a progress bar and I need the total distance of the flight in order to get the % of the flight completed)

If you get what i mean..

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 5:11pm UTC](https://forum.phpvms.net/t/php-help/4426/24 "2011-04-03T17:11:54Z")

</div>

Ah ok great idea, let me have a look, ill get back to you.

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 5:15pm UTC](https://forum.phpvms.net/t/php-help/4426/25 "2011-04-03T17:15:46Z")

</div>

OK in that schedule briefing tpl the function in there,

```
<?php echo "{$schedule->distance}"; ?>

```

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 3, 2011, 5:25pm UTC](https://forum.phpvms.net/t/php-help/4426/26 "2011-04-03T17:25:37Z")

</div>

> OK in that schedule briefing tpl the function in there,
> 
> \<?php echo "{$schedule-\>distance}"; ?\>

Still abit confused here, when I put

```
<?php echo "{$schedule->distance}"; ?>

```

into the acarsmap.tpl file, nothing shows up, Do I need a function in the acars.php module ?

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 6:08pm UTC](https://forum.phpvms.net/t/php-help/4426/27 "2011-04-03T18:08:44Z")

</div>

OK you have to load the schedule number, if your in the acars tpl then you can use the flight, that should work

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 6:09pm UTC](https://forum.phpvms.net/t/php-help/4426/28 "2011-04-03T18:09:48Z")

</div>

Or thinking about it if your creating a module use sql to get what you want.

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 3, 2011, 6:16pm UTC](https://forum.phpvms.net/t/php-help/4426/29 "2011-04-03T18:16:48Z")

</div>

> OK you have to load the schedule number, if your in the acars tpl then you can use the flight, that should work

Sorry for my lack of php knowledge but how would I load the schedule number?

Thanks

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 3, 2011, 6:20pm UTC](https://forum.phpvms.net/t/php-help/4426/30 "2011-04-03T18:20:43Z")

</div>

Ok let me have a play for 5 minutes and ill post the code, Where is it your putting or wanting to show the total distance, is it the acars.tpl

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 3, 2011, 6:22pm UTC](https://forum.phpvms.net/t/php-help/4426/31 "2011-04-03T18:22:12Z")

</div>

> Ok let me have a play for 5 minutes and ill post the code, Where is it your putting or wanting to show the total distance, is it the acars.tpl

Yup in the acars.tpl file.

I do appreciate this

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 6, 2011, 12:41pm UTC](https://forum.phpvms.net/t/php-help/4426/32 "2011-04-06T12:41:37Z")

</div>

> Ok let me have a play for 5 minutes and ill post the code, Where is it your putting or wanting to show the total distance, is it the acars.tpl

Any luck?

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 8, 2011, 8:51pm UTC](https://forum.phpvms.net/t/php-help/4426/33 "2011-04-08T20:51:05Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 16, 2011, 2:59pm UTC](https://forum.phpvms.net/t/php-help/4426/34 "2011-04-16T14:59:51Z")

</div>

Nothing?

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [April 16, 2011, 5:15pm UTC](https://forum.phpvms.net/t/php-help/4426/35 "2011-04-16T17:15:10Z")

</div>

sorry forgot all about this, you should be able to use this function

Not tested though. using the existing api this should give you the total miles

\<?php echo $route-\>distance . Config::Get(‘UNITS’);?\>

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [April 16, 2011, 5:33pm UTC](https://forum.phpvms.net/t/php-help/4426/36 "2011-04-16T17:33:14Z")

</div>

> sorry forgot all about this, you should be able to use this function
> 
> Not tested though. using the existing api this should give you the total miles
> 
> \<?php echo $route-\>distance . Config::Get(‘UNITS’);?\>

When I add the code nothing shows up…

Im guessing I need to add something into the ACARSDate.class.php file?

Maybe something like:

```
public static function getSchedulesByDistance($distance, $type, $onlyenabled=true, $start='', $limit='')
{
	if($type == '')
		$type = '>';

	$params = array('s.distance' => trim($type).' '.$distance);
	if($onlyenabled)
		$params['s.enabled'] = '1';

	return self::findSchedules($params, $limit, $start);
}

```

But when I add that it gives me an error on the site and kACARS gives me about 10 error messages saying it lost connection to the site.. ..so im not gonna mess around with it myself unless no one is flying

Thanks,

James

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [May 22, 2011, 8:44pm UTC](https://forum.phpvms.net/t/php-help/4426/37 "2011-05-22T20:44:12Z")

</div>

…

---

<div class="post-metadata">

**Author:** ![James142](https://forum.phpvms.net/user_avatar/forum.phpvms.net/james142/32/92_2.png) [@James142](https://forum.phpvms.net/u/James142)\
**Post date:** [June 13, 2011, 5:36pm UTC](https://forum.phpvms.net/t/php-help/4426/38 "2011-06-13T17:36:02Z")

</div>

Bump

[Previous page](https://forum.phpvms.net/t/php-help/4426.md?page=1)
