Strider Posted August 13, 2014 Report Posted August 13, 2014 I have some code to put the vatsim id into a txt file and need some help. I have put the following code into the pilots_list.tpl where the vatsim id is place, and it works, but only puts one vatsim id into the text file. $vroute = fopen("vroute.txt", "w") or die("Unable to open file!"); $txt = $fieldvalue."\n"; fwrite($vroute, $txt); fclose($vroute); I have created the vroute.txt file and it has write permission. I need some help in creating this file, as it will make it easier to get my pilots into my VA's vroute community. Quote
Members Vangelis Posted August 13, 2014 Members Report Posted August 13, 2014 What are you trying to achieve ? Maybe we can suggest another aproach Quote
Strider Posted August 13, 2014 Author Report Posted August 13, 2014 Get the vatsim id's into a text file. That way I can link my site with my vroute community. and eventually become a vroute partner airline. Quote
freshJet Posted August 13, 2014 Report Posted August 13, 2014 Your code will overwrite each time. Have a look here and see what works best, including the solution using the fseek() solution. Quote
Strider Posted August 13, 2014 Author Report Posted August 13, 2014 I used the fseek, but nothing shows in the text file. http://malaysiava.org/vroute.txt Quote
Strider Posted August 13, 2014 Author Report Posted August 13, 2014 It is inserting data, but not the vatsim id's. Quote
mseiwald Posted August 14, 2014 Report Posted August 14, 2014 You dont need a txt file for that. At Hellenic I have just a blank page with all the IDs each in a new line. Then use action.php when giving the link to vroute Quote
Strider Posted August 14, 2014 Author Report Posted August 14, 2014 Can you help me with that code please Quote
Members Vangelis Posted August 14, 2014 Members Report Posted August 14, 2014 In what format do you want the file to be ? F.e vid,vid,vid Or vid Vid Vid Quote
mseiwald Posted August 14, 2014 Report Posted August 14, 2014 Like here is our list from Hellenic airways: http://www.flyhellen...hp/VatsimPilots Just make a new Module called Vroute or whatever you like and then in the index function i have this code: $pilots = PilotData::getAllPilots(); foreach($pilots as $pilot) { $fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); if($fieldvalue != '') { if(strlen($fieldvalue) < 5) { continue; } if (!is_numeric($fieldvalue)) { continue; } echo $fieldvalue.'<br />'; } Then all you need to do is give them the link like http://www.YOURSITEURL.com/ACTION.php/vroute Note it`s important that you give then the link with action.php so that in your <body> tags you only have the VATSIM IDs one in a row. Thats all they need and i think the simplest method Quote
Strider Posted August 14, 2014 Author Report Posted August 14, 2014 Thanks mseiwald, that worked. 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.