Vatsim Coding....again

Ok, I have been looking through the forums and tinkering with my site, and I need to try to wrap my head around it…

For adding the vatsim link info to my site, I need to:

  1. Add a text column to the phpvms_pilots table in the sql database, called Vatsim ID?!

  2. Add a box for the inclusion of the Vatsim ID in the registration_mainform.tpl file?!

  3. Change the pilots.tpl file to include the vstsim info already mentioned many times in the forum?!

Is that basically correct. I find reading so many posts about this topic, has only messed up my head

Nope, you need to edit PilotData.class to edit it and Pilots.php module too.

Really Tricky and requires good knowleage. But why not use custom fields?

Ok, so that is in addition to what I said above, correct?!

Yup,

Thanks, Vansers!

Welcome!

Sorry, I see I am not done yet

So, in the Pilots.php and PilotData.class, what am I adding?

Your best and easiest bet in my opinion is to add custom fields in your registration section.

Goto admin -> Site & Settings -> Profile fields

Add a profile field you would like - ie Vatsim, and it will be available in all pilot profiles and the registration form.

There is no need to edit any core files with this method. You can go into individual pilot profiles and edit the field for those that were in the system prior to adding it.

Once this is done this way, is there a way to make the id a link? to say a pilots vataware stats?

currently the only options are text/drop down or text area?

You need to make it a text area and then in your template make it a link. That is what I have done.

so would that be something like:

<a href="http://www.vataware.com/flight.cfm?id=<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>"</a>

so would that be something like:

<a href=“http://www.vataware.com/flight.cfm?id=<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>”

That looks close, I think you will want to change

flight.cfm?id=

to

pilot.cfm?cid=

Cheers Dave

Sorry guys i have just read this thread, this is more complex than it need be.

Add another field on registration VatsimID, IVAO ID etc or what you like then you can call that field in the pilots list or where ever you like,

Examples,

http://www.easyjetva.com/index.php/pilots

You can then output the id’s as a link variable.

<td><div align="center">
     <?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://www.vataware.com/pilot.cfm?cid=' . $fieldvalue . '" target="_blank"><img src="/images/charticon.jpg" width="28" height="28" border="0" alt="Vatsim ID" /></a></a>' ;
}
else
{
echo '<img src="/images/nonreg.png" width="20" height="18" border="0" alt="Not Listed" /></a>' ;
}
?>
   </div></td>

Excellent thanks

The code above presumes you have a field value in registration called Vatsim ID

That is a line from my pilots list tpl

Actually, what do i need to change to just have the pilot cid shown linking to the VATAWARE stats? i have tried all the methods but can’t get it to show.

Mark your way works fine but rather than images just the id number is what im after.

Ah ok just change the image part to the variable

$fieldvalue

I have not tested but should be OK

<td><div align="center">
     <?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://www.vataware.com/pilot.cfm?cid=' . $fieldvalue . '" target="_blank">' . $fieldvalue . '</a></a>' ;
}
else
{
echo '<img src="/images/nonreg.png" width="20" height="18" border="0" alt="" /></a>' ;
}
?>
   </div></td>

That works a treat, thanks Mark…

Great,

Just check that line echo ‘<a href=“http://www.vataware.com/pilot.cfm?cid=’ . $fieldvalue . '” target=“_blank”>’ . $fieldvalue . ’ </a></a>’ ;

Dont think it needs 2 closing tags.