Thursday, June 30, 2011

Re: Pagination Problem

Thanks for answering Johan :)

I tracked the problem down to passing form data via "GET" through an
iframe. I located where the problem was occurring, but I couldn't
figure out why. I tried a few different approaches to no avail. In any
case I resorted to using "POST" and Cache and the app once again works
flawlessly :)

- ED

On Jun 30, 10:31 am, Johan <johan...@gmail.com> wrote:
> 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 <crotchf...@gmail.com> 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 sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: