avdesigns Posted March 29, 2012 Report Posted March 29, 2012 Hello, I have a custom pilot list with a column for status, however I want that column to display active or inactive instead of 1 and 2 <style type="text/css"> <!-- .style2 {color: #CCCCCC} --> </style> <h3><?php echo $title?></h3> <?php if(!$allpilots) { echo 'There are no pilots!'; return; } ?> <table width="945" border="0" class="tablesorter" id="tabledlist"> <thead> <tr> <th bgcolor="#63003A"><span class="style2">Pilot ID</span></th> <th width="25%" bgcolor="#63003A"><span class="style2">Name</span></th> <th width="19%" bgcolor="#63003A"><span class="style2">Rank</span></th> <th width="22%" bgcolor="#63003A"><span class="style2">Flights</span></th> <th width="17%" bgcolor="#63003A"><span class="style2">Hours</span></th> <th width="17%" bgcolor="#63003A"><span class="style2">Status</span></th> </tr> </thead> <tbody> <?php foreach($allpilots as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ // To skip a retired pilot, uncomment the next line: //if($pilot->retired == 1) { continue; } ?> <tr> <td width="7%" nowrap><div align="center"><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a></div></td> <td> <div align="center"><img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo $pilot->firstname.' '.$pilot->lastname?> </div></td> <td><div align="center"><?php echo $pilot->rank;?></div></td> <td><div align="center"><?php echo $pilot->totalflights?></div></td> <td><div align="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></div></td> <td><?php echo $pilot->retired?></td> <?php } ?> </tbody> </table> Thanks Quote
Guest lorathon Posted March 29, 2012 Report Posted March 29, 2012 Change this <td><?php echo $pilot->retired?></td> to this <td><?php if($pilot->retired==0) echo 'ACTIVE'; else echo 'INACTIVE';?></td> Quote
avdesigns Posted March 29, 2012 Author Report Posted March 29, 2012 Thanks Lorathon, Works like a treat Quote
Curshad Posted July 19, 2012 Report Posted July 19, 2012 (edited) Change this <td><?php echo $pilot->retired?></td> to this <td><?php if($pilot->retired==0) echo 'ACTIVE'; else echo 'INACTIVE';?></td> Thanks, I just got this code, i want to use a image instead of the 1 or 2 or the active/inactive, can you give me a code please? _______________________________________________________________________________________| Nevermind i just used this <?php if($pilot->retired==0) echo '<img src="http://qantasvirtual.com/lib/skins/brilliancev1/images/activeman.png"/>'; else echo '<img src="http://qantasvirtual.com/lib/skins/brilliancev1/images/leaveman.png"/>';?> I know a little on this Edited July 19, 2012 by SBM0001 1 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.