Hi
I'm doing something like this:
http://book.cakephp.org/view/249/Custom-Query-Pagination

In the controller, i have given code like this
$this->paginate = array(
        'conditions' => array(
           'search_text' =>$this->params['named']'s_keyword'],
        'action'=>'index',
        'to_member_id' =>$this->session_user,
        'member_id' =>$this->session_user,
        'message_to_from_type' => 'inbox',
        'message_to_status' => 1,
'message_from_status'=>1
        )
);
$this->set('queryResults', $this->paginate());

Then customized paginate()function in the model like this:
function paginate($conditions, $fields,$order,
$limit=2,$page=1,$recursive=null) {
if($conditions['action'] == 'index') {
        $sql .= " Select * from messages, members where messages.id in (
                                select max(id) from messages
                                where (to_member_id = 
".$conditions['to_member_id']." and
message_to_status = '".$conditions['message_to_status']."' and
message_to_type= '".$conditions['message_to_from_type']."' )
                                and
                                (message_title LIKE 
'%".$conditions['search_text']."%' OR
message_description LIKE '%".$conditions['search_text']."%')
                                group by message_reply
                                order by message_date desc)
                        and members.id = messages.member_id
                        order by message_date desc";
        }
$this->recursive = -1;
$results = $this->query($sql);   //print_r($results);
return $results;
}

I then customized paginateCount() also in the model.
Now im getting the $paginator->counter() function working properly,
But $paginator->numbers(); is not returning any page numbers in the
view .Also saeme is the case with $paginator->prev() and next()
functions

Can you pls help me to fix this problem.
Thanks in advance
Anju.

WebbedIT wrote:
> What do you mean by customising the function in the model?  Are you
> doing anything different to that explained at:
> http://book.cakephp.org/view/164/Pagination
>
> HTH
>
> Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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