Guys, below what I did. I think this is better than all the alternatives:
<table cellspacing="0" class="listingTable"> <tr> <? $fields = array( 'Smr.startDate' => 'Date', 'Smr.status' => 'Status', 'Smr.title' => 'Title' ); foreach($fields as $field => $title){ ?> <th><?php echo $paginator->sort($title, $field, array('class' => ($field == $paginator->sortKey() ? $paginator->sortDir() : 'none')));?></th> <? } ?> CSS: table.listingTable th a.none{ background-image: url(/img/icons/arrow_collapse_light.png); } table.listingTable th a.asc{ background-image:url(/img/icons/arrow_expand_dark.png); } table.listingTable th a.desc{ background-image:url(/img/icons/arrow_collapse_dark.png); } Happy coding! Nicolás Andrade *n...@nicoandra.com.ar* Blog <http://www.nicoandra.com.ar> | CV <http://nandrade.awardspace.com> | Flickr <http://www.flickr.com/photos/aanm> | Del.icio.us<http://del.icio.us/nis_>| LastFM <http://www.lastfm.es/user/nis_> On Sun, Jan 11, 2009 at 4:40 PM, DanielMedia <danielmedi...@gmail.com>wrote: > > Thanks for the help but that didn't seem to work. I ended up just > hacking it by writing a custom function: > > <? > function check_sort($paginator, $sort_field) { > if($paginator->sortKey() == $sort_field) { > return ' class="' . $paginator->sortDir() . '"'; > } > } > ?> > > <tr> > <th<?= check_sort($paginator, 'time_of_trade'); ?>><?= $paginator- > >sort('Time of Trade', 'Trade.time_of_trade'); ?></th> > <th<?= check_sort($paginator, 'security_description'); ?>><?= > $paginator->sort('Security Description', > 'Trade.security_description'); ?></th> > <th<?= check_sort($paginator, 'maturity_date'); ?>><?= $paginator- > >sort('Maturity Date', 'Trade.maturity_date'); ?></th> > <th<?= check_sort($paginator, 'coupon'); ?>><?= $paginator->sort > ('Interest Rate', 'Trade.coupon'); ?></th> > <th<?= check_sort($paginator, 'dollar_price'); ?>><?= > $paginator->sort > ('Price', 'Trade.dollar_price'); ?></th> > <th<?= check_sort($paginator, 'yield'); ?>><?= $paginator->sort > ('Yield', 'Trade.yield'); ?></th> > <th<?= check_sort($paginator, 'par_traded'); ?>><?= $paginator->sort > ('Trade Amount', 'Trade.par_traded'); ?></th> > </tr> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---