AspireFSX.com Posted January 23, 2011 Report Posted January 23, 2011 Hi When we create a schedule with the FSX in-built flight plan utility, we submit the .PLN file to admin and this is stored in a folder on the webspace. Now, when a pilot goes to view the schedules, we check the flight number to see if there is a matching .PLN file for it. If we have it, we put PLN File in the column on the right above Details etc. I want to use the4 If ... Then to place a link to the file that the user can right-click and save to prevent them having to look for all the points in the plan but i can't stop the error message thqat an unexpected < has been found ... if (file_exists($filename)) { <a href="<?php echo url('/plns/'.AVA'.$padded_route.'.PLN');?>"PLN File</a><br />; echo '<br />'; } ?> That is the If ... Then - can anyone please educate me as to what is wrong with my piece of code ... i think it may be a mix of " and ' or that it is inside { } so may need to be written totally different ... Outside of the { } it works fine. Thank you for your help Rgds, Stuart Watson Community Founder http://aspirefsx.com Quote
Tom Posted January 23, 2011 Report Posted January 23, 2011 Assuming your variables are all correct and "AVA" is a prefix of every file, this should work: if (file_exists($filename)) { echo '<a href="'.url('/plns/AVA'.$padded_route.'.PLN').'">PLN File</a><br /><br />'; } Quote
AspireFSX.com Posted January 23, 2011 Author Report Posted January 23, 2011 Thank you Tom It did indeed give me a proper path the the file, but sadly it seems that pjp is trying to run the file thru itslef, in so far as when I hover over it gives me http://aspirevirtualair.com/index.php/plns/AVA00008.PLN then the error on clicking that module plns does not exist which is the folder name where the plans are stored. It is as if i need a special php command that says "this is a link to a downloadable file not something to be run thru the php itself" Could you help me on that pls? or point me to a reference I can read? Thank you, Stuart Quote
Tom Posted January 24, 2011 Report Posted January 24, 2011 Ok then in that case try the following: if (file_exists($filename)) { echo '<a href="'.SITE_URL.'/plns/AVA'.$padded_route.'.PLN">PLN File</a><br /><br />'; } Quote
AspireFSX.com Posted January 24, 2011 Author Report Posted January 24, 2011 thank you that worked - I did not realise though that it does not actually recognise it as a file with .pln extension so i cannot right-click on it. However I can now work that with, possibly, .zip files . Appreciate your help S. 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.