Jump to content

Sorting of data


karvenki12

Recommended Posts

Hi,

 

I am trying to figure out how to sort my data either in ASC or DESC order. I tried using set::sort method, paginator:sort method, but not able to find a solution for this. The code that I am currently working on is pasted below. I need to sort the members data by their lastname. I would really appreciate if someone can help me with this.

 

Thank you,

 

 

<div class="members view">

<h2><?php __('Members associated with <b>'.$programs['Program']['name'].'</b>')?></h2>

<table cellpadding="0" cellspacing="0">

<tr>

<th>No</th>

<th>Member</th>

</tr>

<?php

$i = 0;

foreach ($members as $member):

$class = null;

if ($i++ % 2 == 0) {

$class = ' class="altrow"';

                   

}

?>

tr<?php echo $class?>>

<td><?=$i?></td>

<td><?=$member['Member']['lastname']?>, <?=$member['Member']['firstname']?>  <small><i>(<?=$member['Member']['publication_name']?>)</i></small></td>

 

</tr><

 

<?php endforeach; ?>

</table>

</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.