Jump to content

Rank Order


Guest nedra

Recommended Posts

Hi everyone,

I've just spent about 4 hours trying to solve this, but I'm having an awful amount of trouble and I decided to come to the experts.

If we look at my rank directory here: http://www.unityvirtual.net/index.php/rank, we can see that it is sorting the ranks from Lowest (Pilot Recruit) up the top, to Highest (CEO) down the bottom. This makes sense, because the 'rankid' for Pilot Recruit is '1', while the rankid for CEO is '12'...No problems there.

However, I'm trying to swap the order that the ranks appear on that page, without changing any rankid's in the database. I've tried a few things, but nothing has seemed to work, and Google hasn't helped, unfortunately.

The code for my ranks_allranks.tpl is:

<center><h3>Unity Virtual Ranks</h3>
<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Rank Image</th>
<th>Rank</th>
<th>Salary</th>
   <th>Description</th>  </center>
</tr>
</thead>

<tbody>
<?php
foreach($ranks as $rank)
 {
 ?>     
<tr id="row<?php echo $rank->rankid;?>">     
<td align="center" width="200px"><img src="<?php echo $rank->profrankimage; ?>" /></td>     
<td align="center" width="150px"><?php echo $rank->rank; ?></td>     
<td align="center" width="50px">$<?php echo $rank->payrate; ?> per hour</td>     
<td align="justify"><?php echo $rank->rankrequire; ?></td>   
</tr>
<?php
}
?>
</tbody>
</table>

If anyone can please help, i will be eternally grateful. I'm fairly sure it's an easy fix, but anything I've tried hasn't worked.

Thanks very much in advance!

Link to comment
Share on other sites

  • Administrators

Looks like you have a custom module named "rank", the code that you are pulling the data from should be in there, or at least the call for it. If it using the native phpVMS function;

RanksData::getAllRanks()

you would find the line to change in the RanksData.class.php file on line 46;

ORDER BY r.minhours ASC';

but this function should already be ordering from biggest to smallest using the ASC command, so my guess is that it is a custom function within the rank module or a custom data class and you should find something similar to what I have shown here except using the DESC command or no ORDER BY command at all.

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...