Saturday, July 25, 2009

Pagination helper - showing empty pages

Hi all,

Having a couple of problems with the Pagination helper - I'm using the
following code:

function search($id = null)
{

$id = str_replace('-', ' ', $id);

$this->paginate = array(
'limit' => 10,
'order' => array('Member.trade_name' => 'asc'),
'conditions' => array('Region.name' => Inflector::humanize($id)),
'joins' => array(
array(
'table' => 'counties_members',
'alias' => 'CountiesMembers',
'type' => 'INNER',
'conditions' => array('Member.id =
CountiesMembers.member_id')
),
array(
'table' => 'counties',
'alias' => 'County',
'type' => 'INNER',
'conditions' => array('CountiesMembers.county_id =
County.id')
),
array(
'table' => 'regions',
'alias' => 'Region',
'type' => 'INNER',
'conditions' => array('County.region_id = Region.id')
)
),
'fields' => array('DISTINCT Member.trade_name', 'Member.id',
'Member.mem_no', 'Member.contact', 'Member.address1',
'Member.address2', 'Member.address3', 'Member.town', 'Member.county',
'Member.postcode', 'Member.email', 'Member.telephone')
);

// $members = $this->Member->find('all', compact('joins',
'conditions', 'fields', 'order'));
$members = $this->paginate('Member');
$this->layout = "member";
$this->pageTitle = "Search results for ".Inflector::humanize($id);
$this->set('members', $members);

}

which is returning records correctly, however on viewing the page, the
pagination helper is adding additional page links and on clicking on
those links, the view shows an empty recordset.

Any suggestions?

Thanks,

Alastair
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: