Jump to content

Roster Alignment Problem


Tylor Eddy

Recommended Posts

Not in the parent div, but in the table columns (<td>) tags, use a fixed width

Nabeel - having similar issues and your answer, I am sure, is perfectly understandable to folks that have program experiance (I had never done anything like this until last week). Anyway to explain in more detail?

how do we use fixed width?

Link to comment
Share on other sites

  • Administrators

Sorry, no problem.

You probably have something like this:

<table>
<tr>
  <td>Column one</td>
  <td>Column two</td>
</tr>
</table>

Fixed width would be:

<table>
<tr>
  <td width="50%">Column one</td>
  <td width="50%">Column two</td>
</tr>
</table>

Or the width could be a pixel value:

<td width="130px">

Right now there's no fixed width, so they're just automatically sizing to the content. So much make all the columns (the <td> are columns) with that width

Link to comment
Share on other sites

Sorry, no problem.

You probably have something like this:

<table>
<tr>
  <td>Column one</td>
  <td>Column two</td>
</tr>
</table>

Fixed width would be:

<table>
<tr>
  <td width="50%">Column one</td>
  <td width="50%">Column two</td>
</tr>
</table>

Or the width could be a pixel value:

<td width="130px">

Right now there's no fixed width, so they're just automatically sizing to the content. So much make all the columns (the <td> are columns) with that width

Thanks man, sometimes ya gotta talk to me like I am four. Too many hits to the head and jumps out of perfectly good airplanes tend to do that to you.

Link to comment
Share on other sites

  • Moderators

Thanks man, sometimes ya gotta talk to me like I am four. Too many hits to the head and jumps out of perfectly good airplanes tend to do that to you.

did the to many hits to the head let you jump out off perfectly good airplanes ;D

we normaly wait until the plane is on the blocks and the stairs are connected ;D ;D

Link to comment
Share on other sites

  • Administrators

Ok can you explain this to me a bit simpler please. Im new to this manual coding lol.

Thanks for all your help so far

Love PhpVMS!

The parent div style probably needs a float:

style="float: left"

I'm not sure exactly what, but you might have to Google the problem and mess with the CSS. It's a bit difficult to tell just by looking at it

Link to comment
Share on other sites

Thanks, unfortunately i couldn't get it to line up correctly. it's a bit more complicated for me.

here's what my pilot_list.tpl folder looks like now

<h3><?php echo $title?></h3>

<?php

if(!$allpilots)

{

echo 'There are no pilots!';

return;

}

?>

<table id="tabledlist" class="tablesorter">

<thead>

<tr>

<th>Pilot ID</th>

<th>Name</th>

<th>Rank</th>

<th>Flights</th>

<th>Hours</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');

*/

?>

<tr>

<td width="1%" nowrap><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">

<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>

</td>

<td>

<img src="<?php echo Countries::getCountryImage($pilot->location);?>"

alt="<?php echo Countries::getCountryName($pilot->location);?>" />

<?php echo $pilot->firstname.' '.$pilot->lastname?>

</td>

<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>

<td><?php echo $pilot->totalflights?></td>

<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>

<?php

}

?>

</tbody>

</table>

Thanks for all the help so far. Hopefully we can work out this little delema now :)

Link to comment
Share on other sites

  • Administrators

for example to set a column width in that file

<td width="25%"><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
         <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
   </td>

notice the <td width="25%">

set a width for each column and make sure they add up to 100%  ;)

Link to comment
Share on other sites

  • Administrators

a sample row might contain

<tr>
<td width="25%">do stuff</td>
<td width="10%">do stuff</td>
<td width="40%">do stuff</td>
<td width="5%">do stuff</td>
<td width="20%">do stuff</td>
</tr>

the table will then align all the columns to your preset widths. The total of all the "widths" = 100%

Link to comment
Share on other sites

<h3><?php echo $title?></h3>

<?php

if(!$allpilots)

{

echo 'There are no pilots!';

return;

}

?>

<table id="tabledlist" class="tablesorter">

<thead>

<tr>

<th>Pilot ID</th>

<th>Name</th>

<th>Rank</th>

<th>Flights</th>

<th>Hours</th>

</tr>

</thead>

<tbody>

<?php

foreach($allpilots as $pilot)

{

/*

To include a custom field, use the following example:

<td width="10%">

<?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');

*/

?>

<tr>

<td width="10%"><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">

<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>

</td>

<td width="10%">

<img src="<?php echo Countries::getCountryImage($pilot->location);?>"

alt="<?php echo Countries::getCountryName($pilot->location);?>" />

<?php echo $pilot->firstname.' '.$pilot->lastname?>

</td>

<td width="10%"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>

<td width="10%"><?php echo $pilot->totalflights?></td>

<td width="10%"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>

<?php

}

?>

</tbody>

</table>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...