Re: Pagination helper - showing empty pages

2009-07-27 Thread Alastair

On Jul 26, 1:36 am, brian bally.z...@gmail.com wrote:
 I think the condition on Region.name should be under the Region array.

 Have you tried debugging the output to see what the result array looks like?


Hi Brian,

I have done. When I debug a non-paginated recordset, I'm getting 52
records back. When I debug the paginator array, it shows a count of 74
although it only actually returning the correct amount of records.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pagination helper - showing empty pages

2009-07-25 Thread Alastair

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



Re: Pagination helper - showing empty pages

2009-07-25 Thread Alastair

Just a bit more information. If I remove the pagination from the above
and just have it call back all records, it returns 52 records. If I
add the pagination back in, doing a debug($paginator) reports a record
count of 74. Not sure where it's getting that figure from!


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Pagination helper - showing empty pages

2009-07-25 Thread brian
I think the condition on Region.name should be under the Region array.

Have you tried debugging the output to see what the result array looks like?

On Sat, Jul 25, 2009 at 3:49 PM, Alastairalast...@zanginteractive.com wrote:

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