Friday 9 August 2013

pagination for particular condition in cakephp

pagination for particular condition in cakephp

var $paginate = array(
'limit' => 10,
'order' => array(
'Listing.id' => 'desc'
)
);
function admin_view_specific_advertiser($id=null) {
...other code...
$this->set('listings',
$this->Listing->find('all',array('conditions'=>array('Advertiser.id'=>$id))),$this->paginate());
}
URL:http://www.example.com/admin/listings/view_specific_advertiser/4
Total Listings=100
Numbers Listings of Advertiser Having id 4 = 50
Pagination Display:
Page 1 of 10, showing 10 records out of 100 total
The problem is pagination shows only listing data.I want to paginate the
total records of only that particular advertiser(4 in this case).
It should display like this,
Page 1 of 5, showing 10 records out of 50 total

No comments:

Post a Comment