I'm not sure if I understand you correctly but the sort method of the
paginator helper will automatically figure out whether to sort asc or
desc for you

<?php echo $paginator->sort( 'id' ) ?>

http://api.cakephp.org/1.2/class_paginator_helper.html#47126613be03a2453265670a2771900b


On Jul 18, 4:38 pm, Mech7 <[EMAIL PROTECTED]> wrote:
> I am wondering if there is anything to sort asc /desc depending on
> which state they are.. for example they are sorted ASC, click the
> title and they are sorted DESC.. click them again and they turn ASC
> again.. right now i use this:
>
> <?php echo $html->link('Id', '?sort=id&direction=desc'); ?>
>
> But it is not very flexible as it only sorts one way the opposite of
> the default and i prefer to not insert if / else statements in my
> views.
>
> On Jul 17, 11:00 am, Spectacularium <[EMAIL PROTECTED]> wrote:
>
> > There are two functions in the paginator helper for this:
> > $paginator->sortDir()      returns null, 'asc', or 'desc' returns null
> > if the results are not sorted
> > $paginator->sortKey()    The name of the key by which the recordset is
> > being sorted, or
> >                                    null if the results are not
> > currently sorted.
>
> > On Jul 17, 6:39 am, Copot <[EMAIL PROTECTED]> wrote:
>
> > > CakePHP 1.2
> > > Basically i just want to display an image (arrow up or down) which
> > > must be corelated with the sort field and the sort direction.
> > > How can I tell which field is being used and the direction of the
> > > sort?
> > > Can anyone help me ?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to