Could it be that this second page is coming through an ajax request?
This type of error usually pops up when you try to use the PaginationHelper
but no pagination has been done on the controller.

Cheers,
- Johan

On Wed, Jun 29, 2011 at 9:12 PM, Ed Propsner <[email protected]> wrote:

> I've been poking around with this for a bit and have yet to find out what's
> going wrong. I'm passing a paginated result set to a view and everything
> renders fine until I try to access the next page of results.
>
> Example:
>
> // CONTROLLER //
>
> $this->paginate = array(
> 'contain' => array(
>    'OnlineUser',
>    'Seeking',
>    'UserProfile' => array('conditions' => array('UserProfile.order' =>
> 1)),
>    'Score' ,
>    'Photo' => array('conditions' => array('Photo.profile' => 1),
>  'limit' => 1,
> 'fields' => 'name'
>    )
>    ),
> 'conditions' => array(
>       'Seeking.orientation' => $orientation,
>       'User.gender' => $gender,
>       'User.age BETWEEN ? AND ?' => array($minAge, $maxAge),
>       'User.country' => $country,
>       'User.region' => $region,
>       'NOT' => array(
>       ' User.id' => array(2, $this->Auth->User('id'))),
>       'AND' => array($seekingOption)
>       ),
> 'limit' => 5,
>  'order' => 'last_login DESC'
> );
>
>                 $user = $this->paginate('User');
> $this->set(compact('user''));
>
> // VIEW //
>
> <div class="paging">
> <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(),
> null, array('class'=>'disabled'));?>
>  <?php echo $this->Paginator->numbers();?> |
> <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null,
> array('class' => 'disabled'));?>
> </div>
>
>
> I debugged $this->Paginator and everything seems to be in place just as I
> would expect and the first 5 results of the set render just fine in the view
> also as expected. Nothing seems out of place with the Pagination in the
> initial view ... the links generated by $this->Paginator->numbers() and
> $this->Paginator->next() are correct and clicking them loads the appropriate
> controller/action ... ie. /controller/action/page:2. This is the point where
> it starts throwing errors. The view is complaining about "undefined
> variable", "invalid argument supplied for foreach()", "undefined property
> View::Paginator" ... pretty much everything you would expect if no data were
> being passed to the view. I'll also add that the pagination works just as it
> should everywhere else throughout the app with no issues.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to