This is just a wild guess, but perhaps it is not applied when you're
using requestAction()? It is (if I understand correctly) a separate
request as far as cake is concerned.

Try adding the paginator manually in your controller, and if that
doesn't work maybe someone else will offer more help.

On Jan 29, 10:06 pm, Xoubaman <[email protected]> wrote:
> I edited some code to make it more readable in the group, looks like
> that is a misstip. The requestAction works fine, in fact if I comment
> all $paginator mentions the foreach shows the expected results.
>
> The doc reads that setting var $paginate and using the method paginate
> () automatically adds the PaginationHelper.
>
> On Jan 29, 8:50 pm, "dr. Hannibal Lecter" <[email protected]> wrote:
>
> > Well, maybe you didn't include the PaginatorHelper in your app.
>
> > Other thing which seems odd to me is that your controller is
> > "ItemsComments", but in your element you're calling 
> > $this->requestAction('items/get_comments/'.$id). Is 'items/get_comments/'
>
> > properly mapped to ItemsComments::index()?
>
> > On Jan 29, 7:22 pm, Xoubaman <[email protected]> wrote:
>
> > > I'm trying to code an element that shows the comments about a certain
> > > item, but when I'm using the paginator helper i get a "Fatal error:
> > > Call to a member function numbers() on a non-object in[...]" message.
>
> > > Searching the group i found that some users had the same problem, but
> > > never received a valid answer, so... let's try again.
>
> > > The code:
>
> > > CONTROLLER:
>
> > > class ItemsCommentsController extends AppController {
>
> > >         function index($id = null) {
> > >                 if (!$id) {
> > >                         $this->Session->setFlash(__('Invalid Item.', 
> > > true));
> > >                         $this->redirect(array('action'=>'index'));
> > >                 }
> > >                 $comments = $this->paginate('ItemComment', array
> > > ('ItemComment.item_id =' => $id));
>
> > >                 if(isset($this->params['requested'])) { return $comments;}
>
> > >                 $this->set('comments', $comments);
> > >         }
>
> > > }
>
> > > VIEW:
>
> > > echo $this->element('item_comments',array('id'=>$item['Item']['id']));
>
> > > ELEMENT:
>
> > > <?php $comments = $this->requestAction('items/get_comments/'.$id); ?>
> > > <?php
> > >   echo $paginator->numbers(); ?>
> > >   echo $paginator->prev('« Previous ', null, null, array('class' =>
> > > 'disabled'));
> > >   echo $paginator->next(' Next »', null, null, array('class' =>
> > > 'disabled'));
> > >   foreach ($comments as $comment){
> > >      echo '<br />User: '.$comment['User']['username']).'<br />';
> > >      echo $comment['ItemComment']['content'].'<br />';
> > >   }
> > > ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to