Jump to content

Recommended Posts

Posted

Hello everyone,

I want to show the operator logo on my VA live map but I have this problem: I used the code

<img src="<?php echo SITE_URL; ?>/lib/skins/vairline/img/logos/small/<%=flight.code%>.png">

but it takes the pilot code, not the airline code, so it shows a wrong image. Is there anyway to fix it?

  • Administrators
Posted

You are probably looking for

<%=flight.flightnum%>

You can use that and trim all but the digits that you need off of it, or create another variable coming from the controller.

Posted

Hi Simpilot,

I tried it but it takes the whole number (ICAO with flight number), I would like to take just the flight code in corder to show the right operator logo. Thanks.

  • Administrators
Posted

Best way to do it is probably to add it to the initial call for data. In /core/modules/ACARS/ACARS.php find

$this->acarsflights[] = $c;

and add

$c['flightcode'] = substr($c['flightnum'], 0, 3);

on the line above it.

Now in your acars map template you should have the js variable

<%=flight.flightcode%>

available that holds only the ABC of the flight number.

NOTE: this is a core file hack so in an update it will be overwritten. Best thing would be to create a new module that holds this code to protect it in an update.

  • Like 1
Posted

I edited but it did not work (I attached a image for you to see). Do you mean that $this->acarsflights[]= $c; my be changed by $this->acarsflights[]=$c['flightcode']= substr($c['flightnum'],0,3);?

post-615-0-30389400-1406476987_thumb.png

  • Administrators
Posted

No just add the line I show right above the existing line to add it to the array. then in your template you should be able to do something like

<img src="path/to/my/image/<%=flight.flightcode%>.jpg" alt="alt" />

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...