Imanol Posted July 24, 2014 Report Share Posted July 24, 2014 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? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 25, 2014 Administrators Report Share Posted July 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
Imanol Posted July 26, 2014 Author Report Share Posted July 26, 2014 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. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 26, 2014 Administrators Report Share Posted July 26, 2014 Yes, then use php to trim off everything after the first three digits. Quote Link to comment Share on other sites More sharing options...
Imanol Posted July 26, 2014 Author Report Share Posted July 26, 2014 Can you you explain it to me, please? I have a very basic knoeledge of PHP. Thanks. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 27, 2014 Administrators Report Share Posted July 27, 2014 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. 1 Quote Link to comment Share on other sites More sharing options...
Imanol Posted July 27, 2014 Author Report Share Posted July 27, 2014 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);? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 27, 2014 Administrators Report Share Posted July 27, 2014 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" /> Quote Link to comment Share on other sites More sharing options...
Imanol Posted July 28, 2014 Author Report Share Posted July 28, 2014 It works perfectly! Thank so much simpilot! 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.